Skip to content

Instantly share code, notes, and snippets.

@McTano
Last active May 24, 2016 23:44
Show Gist options
  • Save McTano/d33c659285c0e95d8c71975f4971e4a8 to your computer and use it in GitHub Desktop.
Save McTano/d33c659285c0e95d8c71975f4971e4a8 to your computer and use it in GitHub Desktop.
# checks for all the conditions that make shakil momentarily shut up.
def said_magic_words?(input)
input.include?("treat") ||
input.include?("shakil") && input.include?("stop")
end
# fancy prompt a la James
def prompt
print "> "
gets.chomp.downcase
end
# a conversation with a dog.
def talk_to_shakil
loop do
you_said = prompt
puts case you_said
when "woof"
"WOOF WOOF WOOF"
when "meow"
"woof woof woof woof woof"
when "go away"
break
else
said_magic_words?(you_said) ? "..." : "woof"
end
end
end
puts "woof"
talk_to_shakil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment