Created
February 1, 2012 11:50
-
-
Save anonymous/1716721 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 'Say something nice to Grandma.' | |
puts 'You may need to shout > ' | |
$counter = 0 | |
def speaks() | |
$speak = gets.strip | |
if $speak != 'Bye' | |
talk() | |
else | |
exitPlan() | |
end | |
end | |
def talk() | |
if $speak == $speak.downcase | |
puts 'Huh Speak up Sonny' | |
$counter -= 1 | |
else | |
year = rand(1930..1951) | |
puts 'No not Since ' + year.to_s | |
$counter -= 1 | |
end | |
if $counter < 0 | |
$counter = 0 # don't want counter going below zero. | |
end | |
puts 'Say something nice to Grandma' | |
speaks() | |
end | |
def exitPlan() | |
$counter += 1 | |
unless $counter == 3 | |
puts 'Say something nice to Grandma' | |
speaks() | |
else | |
puts 'good night Sonny' | |
end | |
end | |
speaks() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment