Created
December 10, 2010 03:36
-
-
Save agmcleod/735723 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 'net/http' | |
#require 'URI' | |
json = Net::HTTP.get(URI.parse('http://roulette.engineyard.com')) | |
lucky_number = json.gsub(/\{|\}/, '').split(':')[1].gsub(/\"/,'').to_i | |
def play_roulette(bet, lucky_number) | |
pay_out = 100 | |
mod = case lucky_number | |
when 7..12, 14..19 then 2 | |
when 13 then 5 | |
when 2..6, 20..24 then 1 | |
else 0 | |
end | |
return pay_out * mod | |
end | |
puts play_roulette(40, lucky_number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment