Skip to content

Instantly share code, notes, and snippets.

@jackieiscool
Created May 21, 2014 03:05
Show Gist options
  • Save jackieiscool/2033f5eb4c012879f296 to your computer and use it in GitHub Desktop.
Save jackieiscool/2033f5eb4c012879f296 to your computer and use it in GitHub Desktop.
def roulette(bet, total)
unless total < bet
total -= bet
color = choose_color
if color == "black"
return bet * 2 + total
else
return roulette(bet * 2, total)
end
end
return total
end
def choose_color
wheel = (0..36).to_a << 0
spin = wheel.sample
spin.odd? ? "black" : "red"
end
puts roulette(5, 300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment