Created
June 26, 2013 18:22
-
-
Save cnocon/5869955 to your computer and use it in GitHub Desktop.
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
puts "This is the deaf grandma extended problem. Type something for your Grandma." | |
words = gets.chomp | |
bye_count = 1 | |
words_prev = words | |
while bye_count <= 3 | |
if bye_count == 3 #I HAD THIS SET AS 3 FOR THE LONGEST TIME, UNTIL I REMEMBERED THE ITERATIONS ARE ZERO-INDEXED, DUR | |
puts "Bye sweetie!" | |
break | |
elsif words == "BYE" && words_prev != "BYE" | |
bye_count == 1 | |
elsif words == "BYE" && words_prev == "BYE" | |
bye_count += 1 | |
elsif words == words.upcase | |
puts "No! Not since " + rand(1930...1950).to_s + "!" | |
else | |
puts "HUH? SPEAK UP SONNY!" | |
end | |
words_prev == words | |
words = gets.chomp | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment