Also from the Chris Pine tutorial for beginners:

 =95 Write a Deaf Grandma program. Whatever you say to grandma (whatever
you type in), she should respond with HUH?!  SPEAK UP, SONNY!, unless
you shout it (type in all capitals). If you shout, she can hear you
(or at least she thinks so) and yells back, NO, NOT SINCE 1938! To
make your program really believable, have grandma shout a different
year each time; maybe any year at random between 1930 and 1950. (This
part is optional, and would be much easier if you read the section on
Ruby's random number generator at the end of the methods  chapter.)
You can't stop talking to grandma until you shout BYE.
Hint: Don't forget about chomp! 'BYE'with an Enter is not the same as
'BYE' without one!
Hint 2: Try to think about what parts of your program should happen
over and over again. All of those should be in your while loop.

=95 Extend your Deaf Grandma program: What if grandma doesn't want you
to leave? When you shout BYE, she could pretend not to hear you.
Change your previous program so that you have to shout BYE three times
in a row. Make sure to test your program: if you shout BYE three
times, but not in a row, you should still be talking to grandma.


Here is what I came up with:

#Grandma is deaf!

puts "Hey Sonny! It's your lovely Grandmother! How are yeah?"

response =3D "nope"
bye =3D 0

while bye < 3
  response =3D gets.chomp
if response =3D=3D (response.upcase and "BYE")
  puts "Hmmm... I would prefer..."
  bye =3D (bye+1)
end
if response !=3D response.upcase
  puts "Huh?! I CAN'T HEAR YOU!"
end
if (response =3D=3D response.upcase and response !=3D "BYE")
  puts "NO! NOT SINCE " + (1930+rand(21)).to_s + "!"
end
end

Is there an easier way?