Last active
August 29, 2015 14:10
-
-
Save joshmun23/6a727fca8042c6c161de to your computer and use it in GitHub Desktop.
Deaf Grandma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def upcase? | |
self == self.upcase | |
end | |
end | |
puts "HI THERE, SONNY!!" | |
while true | |
reply = gets.chomp | |
break if reply == 'BYE' | |
lowercase_response = "HUH?! SPEAK UP, SONNY!" | |
uppercase_response = "NO, NOT SINCE #{rand(1930..1950)}" | |
puts response = reply.upcase? ? uppercase_response : lowercase_response | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def upcase? | |
self == self.upcase | |
end | |
end | |
puts "HI THERE, SONNY!!" | |
bye_counter = 0 | |
while bye_counter < 3 | |
reply = gets.chomp | |
bye_counter = reply == 'BYE' ? bye_counter + 1 : 0 | |
lowercase_response = "HUH?! SPEAK UP, SONNY!" | |
uppercase_response = "NO, NOT SINCE #{rand(1930..1950)}" | |
unless reply == 'BYE' | |
puts response = reply.upcase? ? uppercase_response : lowercase_response | |
end | |
end | |
puts "Fine.. I'll just go play bingo with the girls.." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment