Skip to content

Instantly share code, notes, and snippets.

@jackieiscool
Created June 27, 2012 01:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackieiscool/3000672 to your computer and use it in GitHub Desktop.
Save jackieiscool/3000672 to your computer and use it in GitHub Desktop.
eightball
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