Skip to content

Instantly share code, notes, and snippets.

@cnocon
Created June 26, 2013 18:22
Show Gist options
  • Save cnocon/5869955 to your computer and use it in GitHub Desktop.
Save cnocon/5869955 to your computer and use it in GitHub Desktop.
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