Beispiel #1
0
    def test_Wheel(self):
        """
        http://www.itmaybeahack.com/book/oodesign-python-2.1/html/roulette/wheel.html#the-random-bin-selection-responsibility

        Wheel Deliverables
        A class which performs a unit test of building the Wheel class. The unit test should create
        several instances of Outcome, two instances of Bin, and an instance of Wheel. The unit test
        should establish that Bins can be added to the Wheel. A Non-Random Random Number Generator
        class, to be used for testing. A class which tests the Wheel and NonRandom class by
        selecting values from a Wheel object.
        """

        outcome_one = Outcome("Red", 1)
        outcome_two = Outcome("Corner", 2)
        outcome_three = Outcome("Black", 3)
        outcome_four = Outcome("Street", 4)

        nonrandom = NonRandom()
        nonrandom.set_seed(1)

        wheel_one = Wheel(nonrandom)
        wheel_one.add_outcome(1, outcome_one)
        wheel_one.add_outcome(2, outcome_two)
        wheel_one.next()

        self.assertTrue(wheel_one.next(), outcome_one )

        # test get_outcome
        self.wheel_two = Wheel(nonrandom)
        BB = BinBuilder()
        BB.build_bins(self.wheel_two)
Beispiel #2
0
    def test_BinBuilder(self):

        nonrandom = NonRandom()
        nonrandom.set_seed(1)

        wheel_one = Wheel(nonrandom)

        BB = BinBuilder()
        BB.build_bins(wheel_one)

        # maybe delete since it isn't asked for
        strait = BB.strait_bets()
        split = BB.split_bets()
        street = BB.street_bet()
        corner = BB.corner_bet()
        five = BB.five_bet()
        line = BB.line_bet()
        dozen = BB.dozen_bet()
        column = BB.column_bet()
        even = BB.even_money_bet()

        all_bin_methods_results = [
            strait, split, street, corner, five, line, dozen, column, even
        ]
        len_all_outcomes = sum(list(len(i) for i in all_bin_methods_results))
Beispiel #3
0
    def test_Wheel(self):
        """
        http://www.itmaybeahack.com/book/oodesign-python-2.1/html/roulette/wheel.html#the-random-bin-selection-responsibility

        Wheel Deliverables
        A class which performs a unit test of building the Wheel class. The unit test should create
        several instances of Outcome, two instances of Bin, and an instance of Wheel. The unit test
        should establish that Bins can be added to the Wheel. A Non-Random Random Number Generator
        class, to be used for testing. A class which tests the Wheel and NonRandom class by
        selecting values from a Wheel object.
        """

        outcome_one = Outcome("Red", 1)
        outcome_two = Outcome("Corner", 2)
        outcome_three = Outcome("Black", 3)
        outcome_four = Outcome("Street", 4)

        nonrandom = NonRandom()
        nonrandom.set_seed(1)

        wheel_one = Wheel(nonrandom)
        wheel_one.add_outcome(1, outcome_one)
        wheel_one.add_outcome(2, outcome_two)
        wheel_one.next()

        self.assertTrue(wheel_one.next(), outcome_one)

        # test get_outcome
        self.wheel_two = Wheel(nonrandom)
        BB = BinBuilder()
        BB.build_bins(self.wheel_two)
Beispiel #4
0
 def setUp(self ):
     self.nonrandom = NonRandom()
     self.nonrandom.set_seed(1) # red
     wheel = Wheel(self.nonrandom)
     self.table = Table(limit=100)
     bin_builder = BinBuilder()
     bin_builder.build_bins(wheel)
     self.game = RouletteGame(wheel, self.table)
Beispiel #5
0
 def setUp(self):
     self.nonrandom = NonRandom()
     self.nonrandom.set_seed(1)  # red
     wheel = Wheel(self.nonrandom)
     self.table = Table(limit=100)
     bin_builder = BinBuilder()
     bin_builder.build_bins(wheel)
     self.game = RouletteGame(wheel, self.table)
Beispiel #6
0
 def setUp(self):
     # wheel -- returns bin 2
     self.nonrandom = NonRandom()
     self.nonrandom.set_seed(2) # black
     wheel = Wheel(self.nonrandom)
     self.table = Table(limit=100)
     bin_builder = BinBuilder()
     bin_builder.build_bins(wheel)
     self.game = RouletteGame(wheel, self.table)
Beispiel #7
0
 def setUp(self):
     # wheel -- returns bin 2
     self.nonrandom = NonRandom()
     self.nonrandom.set_seed(2)  # black
     wheel = Wheel(self.nonrandom)
     self.table = Table(limit=100)
     bin_builder = BinBuilder()
     bin_builder.build_bins(wheel)
     self.game = RouletteGame(wheel, self.table)
def test_wheel_next():
    wheel = Wheel(seed=1)
    bb = BinBuilder()

    # bb.generate_straight_bets(wheel)
    bb.build_bins(wheel)
    # wheel.add_outcome(0, Outcome(f'0', 35))
    ct = 10
    expected_seq = [8, 36, 4, 16, 7, 31, 28, 30, 24, 13]
    for num in expected_seq:
        i, bin = wheel.next()
        assert num == i
Beispiel #9
0
    def test_game(self):
        log = logging.getLogger( "GameTestCase.test_game" )

        # make wheel
        self.nonrandom = NonRandom()
        self.nonrandom.set_seed(2)
        self.wheel = Wheel(self.nonrandom)
        # make BinBuilder and build bins for wheel
        bin_builder = BinBuilder()
        bin_builder.build_bins(self.wheel)
        # make table
        table = Table(limit=100)
        # make player
        _p57 = Passenger57(table=table, stake=100, rounds_to_go=100)
        # make game
        self.game = RouletteGame(self.wheel, table)

        # Test NonRandom
        self.assertEqual(id(self.wheel.next()), id(self.wheel.next()))

        # test game cycle with Passenger57
        for i in range(4):
            self.game.cycle(_p57)
Beispiel #10
0
    def test_BinBuilder(self):

        nonrandom = NonRandom()
        nonrandom.set_seed(1)

        wheel_one = Wheel(nonrandom)

        BB = BinBuilder()
        BB.build_bins(wheel_one)

        # maybe delete since it isn't asked for
        strait = BB.strait_bets()
        split = BB.split_bets()
        street = BB.street_bet()
        corner = BB.corner_bet()
        five = BB.five_bet()
        line = BB.line_bet()
        dozen = BB.dozen_bet()
        column = BB.column_bet()
        even = BB.even_money_bet()

        all_bin_methods_results = [strait, split, street, corner, five, line, dozen, column, even]
        len_all_outcomes = sum(list(len(i) for i in all_bin_methods_results))
Beispiel #11
0
    def test_game(self):
        log = logging.getLogger("GameTestCase.test_game")

        # make wheel
        self.nonrandom = NonRandom()
        self.nonrandom.set_seed(2)
        self.wheel = Wheel(self.nonrandom)
        # make BinBuilder and build bins for wheel
        bin_builder = BinBuilder()
        bin_builder.build_bins(self.wheel)
        # make table
        table = Table(limit=100)
        # make player
        _p57 = Passenger57(table=table, stake=100, rounds_to_go=100)
        # make game
        self.game = RouletteGame(self.wheel, table)

        # Test NonRandom
        self.assertEqual(id(self.wheel.next()), id(self.wheel.next()))

        # test game cycle with Passenger57
        for i in range(4):
            self.game.cycle(_p57)
Beispiel #12
0
 def setUp(self):
     self.wheel = Wheel()
     bb = BinBuilder()
     bb.build_bins(self.wheel)