Created
December 4, 2014 21:28
-
-
Save jshawl/750cc8f40e70095b115b 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
require 'sinatra' | |
require 'sinatra/reloader' | |
get '/coin_toss' do | |
return ['Heads','Tails'].sample | |
end | |
get '/dice_roll' do | |
rand(1..6).to_s | |
end | |
get '/magic8ball/:question' do | |
answers = [ | |
"It is certain", | |
"It is decidedly so", | |
"Without a doubt", | |
"Yes definitely", | |
"You may rely on it", | |
"As I see it yes", | |
"Most likely", | |
"Outlook good", | |
"Yes", "Signs point to yes", | |
"Reply hazy try again", | |
"Ask again later", | |
"Better not tell you now", | |
"Cannot predict now", | |
"Concentrate and ask again", | |
"Don't count on it", | |
"My reply is no", | |
"My sources say no", | |
"Outlook not so good", | |
"Very doubtful" | |
] | |
return params[:question] + "? <br>" + answers.sample | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment