Skip to content

Instantly share code, notes, and snippets.

@agmcleod
Created December 10, 2010 03:36
Show Gist options
  • Save agmcleod/735723 to your computer and use it in GitHub Desktop.
Save agmcleod/735723 to your computer and use it in GitHub Desktop.
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