Outcome contains a single outcome on
which a bet can be placed. In Roulette, each spin of the wheel has a
number of Outcomes. For example, the
“1” bin has the following winning
Outcomes: “1”, “Red”,
“Odd”, “Low”, “Column 1”,
“Dozen 1-12”, “Split 1-2”, “Split
1-4”, “Street 1-2-3”, “Corner
1-2-4-5”, “Five Bet”, “Line
1-2-3-4-5-6”, “00-0-1-2-3”, “Dozen
1”, “Low” and “Column 1”.
String name ;Holds the name of the Outcome.
Examples include "1",
"Red".
int odds ;Holds the payout odds for this
Outcome. Most odds are stated as 1:1 or
17:1, we only keep the numerator (17) and assume the denominator
is 1.
Outcome(String name,
int odds);Sets the local name and odds from the parameter name and odds.
int winAmount(int amount);Multiplies this Outcome's odds by
the given amount. The product is returned.
An easy-to-read String output method is also very handy.
This should return a String representation of the
name and the odds. A form that looks like 1-2 Split
(17:1) works nicely. In Java, this is done as
follows.
public String toString();In Python, the following declaration is used.
def __str__(self):For some tips on how to do this, see Formatting in Java. Python formatting is done more
simply, using the %
operator.