Last active
May 24, 2016 23:44
-
-
Save McTano/d33c659285c0e95d8c71975f4971e4a8 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
# 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