Created
June 27, 2012 01:28
-
-
Save jackieiscool/3000672 to your computer and use it in GitHub Desktop.
eightball
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
class EightBall | |
def response | |
response_array = ["Signs point to yes", | |
"Signs point to no", | |
"AHAHAHAHA!", | |
"Outlook is positive", | |
"No way Jose!"] | |
response_num = rand(response_array.length) | |
puts response_output = response_array[response_num] | |
end | |
def run | |
input = "" | |
while input != "q" | |
puts "Tell me your hopes and dreams" | |
input = gets.chomp | |
input == "q" ? "Goodbye!" : response | |
end | |
end | |
end | |
eight = EightBall.new | |
eight.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment