Title / Description
Code class Roulette @fields = {0 => "green", 1 => "red", 2 => "black", 3 => "red", 4 => "black", 5 => "red", 6 => "black", 7 => "red", 8 => "black", 9 => "red", 10 => "black", 11 => "red", 12 => "black", 13 => "red", 14 => "black", 15 => "red", 16 => "black", 17 => "red", 18 => "black", 19 => "red", 20 => "black", 21 => "red", 22 => "black", 23 => "red", 24 => "black", 25 => "red", 26 => "black", 27 => "red", 28 => "black", 29 => "red", 30 => "black", 31 => "red", 32 => "black", 33 => "red", 34 => "black", 35 => "red", 36 => "black"} public def Roulette.turn number = rand(@fields.length) @fields[number] end def Roulette.number color @fields[color] end def Roulette.probability type if (type == "number") (1/37) elsif (type == "color") (18/37) elsif (type == "red") (18/37) elsif (type == "black") (18/37) elsif (type == "dozen") (12/37) elsif (type == "odd") (18/37) elsif (type == "even") (18/37) elsif (type == "null") (1/37) end end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code