Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2012 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1716721 to your computer and use it in GitHub Desktop.
Save anonymous/1716721 to your computer and use it in GitHub Desktop.
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