Skip to content

Instantly share code, notes, and snippets.

@tooky
Created Sep 22, 2008
Embed
What would you like to do?
RESULTS = %w(H H H H H H A A A A A D)
def result
RESULTS[rand(RESULTS.length)]
end
require 'readline'
def prompt(prompt="> ")
input = nil
lines = []
prompt += " " unless prompt =~ /\s$/
loop do
input = Readline.readline(prompt, true)
break if input == "."
lines.push input
end
return lines
end
fixtures = prompt
results = fixtures.map do |fixture|
if fixture.empty?
fixture
else
fixture + result
end
end
puts results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment