Bin contains a collection of
Outcomes which reflect the winning bets that
are paid for a particular bin on a Roulette wheel. In Roulette, each
spin of the wheel has a number of Outcomes.
Example: A spin of 1, selects the “1” bin with 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”. These are
collected into a single Bin.
Python programmers should provide an initializer that uses the
* modifier so that all of the
individual arguments appear as a single list within the
initializer.
def __init__(self, *outcomes):This constructor can be used as follows.
def add(self, outcome):Adds an Outcome to this
Bin. This can be used by a builder to
construct all of the bets in this Bin.
Since this class is really just a façade over the underlying
collection object, this method can simply delegate the real work
to the underlying collection. Note that a tuple is
immutable; unlike a list it does not have an
append method. Instead, a
tuple is constructed by using the “+”
operator which creates a new tuple from two input tuples.
def __str__(self):An easy-to-read String output method is also very handy.
This should return a String representation of the
list of Outcomes in this
Bin. A handy technique for displaying
collections is the following. This maps the
str function to each element of
self.outcomes, then joins the resulting
string with “,” separators.