Beispiel #1
0
    def generate_street_bets(self, wheel):
        """
        Generates the street bets outcomes and assigns them to the appropriate bins of the wheel

        """
        for row in range(12):
            first_column_number = (3 * row) + 1
            wheel.add_outcome_to_wheel_bin(
                first_column_number,
                Outcome(
                    "{" + "{} - {} - {}".format(
                        str(first_column_number), str(first_column_number + 1),
                        str(first_column_number + 2)) + "}", 11))
            wheel.add_outcome_to_wheel_bin(
                first_column_number + 1,
                Outcome(
                    "{" + "{} - {} - {}".format(
                        str(first_column_number), str(first_column_number + 1),
                        str(first_column_number + 2)) + "}", 11))
            wheel.add_outcome_to_wheel_bin(
                first_column_number + 2,
                Outcome(
                    "{" + "{} - {} - {}".format(
                        str(first_column_number), str(first_column_number + 1),
                        str(first_column_number + 2)) + "}", 11))
Beispiel #2
0
        def add_outcome_to_wheel(column_number, wheel):
            """
            Helper function to add the outcome to the bins of the wheel

            """
            wheel.add_outcome_to_wheel_bin(
                column_number,
                Outcome(
                    "{" + "{} - {} - {} - {}".format(
                        str(column_number), str(column_number + 1),
                        str(column_number + 3), str(column_number + 4)) + "}",
                    8))
            wheel.add_outcome_to_wheel_bin(
                column_number + 1,
                Outcome(
                    "{" + "{} - {} - {} - {}".format(
                        str(column_number), str(column_number + 1),
                        str(column_number + 3), str(column_number + 4)) + "}",
                    8))
            wheel.add_outcome_to_wheel_bin(
                column_number + 3,
                Outcome(
                    "{" + "{} - {} - {} - {}".format(
                        str(column_number), str(column_number + 1),
                        str(column_number + 3), str(column_number + 4)) + "}",
                    8))
            wheel.add_outcome_to_wheel_bin(
                column_number + 4,
                Outcome(
                    "{" + "{} - {} - {} - {}".format(
                        str(column_number), str(column_number + 1),
                        str(column_number + 3), str(column_number + 4)) + "}",
                    8))
Beispiel #3
0
    def setUp(self):
        """
        setup function for the TestBin class

        """
        self.outcome_1 = Outcome('Red', 17)
        self.outcome_2 = Outcome('00-0-1-2-3', 6)
        self.outcome_3 = Outcome('00', 35)
Beispiel #4
0
    def setUp(self):
        """
        setup function for the TestBin class

        """
        self.wheel = Wheel()
        self.outcome_1 = Outcome('Red', 17)
        self.outcome_2 = Outcome('00-0-1-2-3', 6)
        self.outcome_3 = Outcome('00', 35)
        self.bin1 = Bin({self.outcome_1, self.outcome_2, self.outcome_3})
        self.bin2 = Bin(
            {self.outcome_1,
             Outcome('00-0-1-2-3', 6), self.outcome_3})
Beispiel #5
0
    def test_hash_equal(self):
        """
        Tests that the hash values of two Outcome objects with the same name are equal

        """
        other_outcome = Outcome('Red', 18)
        self.assertTrue(hash(self.outcome) == hash(other_outcome))
Beispiel #6
0
    def test_compare_not_equal(self):
        """
        Tests that two Outcome objects that do not have the same name are unequal

        """
        other_outcome = Outcome('Black', 17)
        self.assertTrue(self.outcome != other_outcome)
Beispiel #7
0
    def test_compare_equal(self):
        """
        Tests that two Outcome objects with the same name are equal

        """
        other_outcome = Outcome('Red', 18)
        self.assertTrue(self.outcome == other_outcome)
Beispiel #8
0
    def generate_straight_bets(self, wheel):
        """
        Generates the straight bets outcomes and adds them to the appropriate bin of the wheel

        """
        for number in range(1, 37):
            wheel.add_outcome_to_wheel_bin(number, Outcome(str(number), 35))
Beispiel #9
0
 def generate_column_bets(self, wheel):
     """
      Generates the column bets outcomes and adds them to the appropriate bins of the wheel
     """
     for column in range(3):
         column_outcome = Outcome(str(column + 1), 2)
         for row in range(12):
             wheel.add_outcome_to_wheel_bin((3 * row) + column + 1,
                                            column_outcome)
Beispiel #10
0
 def generate_dozen_bets(self, wheel):
     """
      Generates the dozen bets outcomes and adds them to the appropriate bins of the wheel
     """
     for dozen in range(3):
         dozen_outcome = Outcome(str(dozen + 1), 2)
         for number in range(12):
             wheel.add_outcome_to_wheel_bin((12 * dozen) + number + 1,
                                            dozen_outcome)
Beispiel #11
0
    def test_construct_bin_from_outcomes(self):
        """
        Tests that bins can be constructed from instances of the outcome class

        """
        bin1 = Bin({self.outcome_1, self.outcome_2, self.outcome_3})
        bin2 = Bin({self.outcome_1, Outcome('00-0-1-2-3', 6), self.outcome_3})

        self.assertEqual(bin1, bin2)
Beispiel #12
0
    def generate_money_bets(self, wheel):
        """
        Generates the money bets outcomes and adds them to the appropriate bins of the wheel

        """
        red_outcome = Outcome("Red", 1)
        black_outcome = Outcome("Black", 1)
        even_outcome = Outcome("Even", 1)
        odd_outcome = Outcome("Odd", 1)
        high_outcome = Outcome("High", 1)
        low_outcome = Outcome("Low", 1)
        for number in range(1, 37):
            if 1 <= number < 19:
                wheel.add_outcome_to_wheel_bin(number, low_outcome)
            else:
                wheel.add_outcome_to_wheel_bin(number, high_outcome)

            if number % 2 == 0:
                wheel.add_outcome_to_wheel_bin(number, even_outcome)
            else:
                wheel.add_outcome_to_wheel_bin(number, odd_outcome)

            if number in {
                    1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32,
                    34, 36
            }:
                wheel.add_outcome_to_wheel_bin(number, red_outcome)
            else:
                wheel.add_outcome_to_wheel_bin(number, black_outcome)
Beispiel #13
0
class TestOutcomeMethods(unittest.TestCase):
    """
    Test class for the Outcome class methods

    """
    def setUp(self):
        """
        setup function for the TestOutcomeMethods class

        """
        self.outcome = Outcome('Red', 17)

    def test_win_amount(self):
        """
        Tests that the amount returned by the win_amount method is correct

        """
        win_amount = self.outcome.win_amount(2)
        self.assertEqual(win_amount, 34)

    def test_compare_equal(self):
        """
        Tests that two Outcome objects with the same name are equal

        """
        other_outcome = Outcome('Red', 18)
        self.assertTrue(self.outcome == other_outcome)

    def test_compare_not_equal(self):
        """
        Tests that two Outcome objects that do not have the same name are unequal

        """
        other_outcome = Outcome('Black', 17)
        self.assertTrue(self.outcome != other_outcome)

    def test_hash_equal(self):
        """
        Tests that the hash values of two Outcome objects with the same name are equal

        """
        other_outcome = Outcome('Red', 18)
        self.assertTrue(hash(self.outcome) == hash(other_outcome))

    def test_string_representation(self):
        """
        Tests that the string returned by str(Outcome) has the correct format

        """
        expected_string = 'Red (17:1)'
        self.assertTrue(str(self.outcome) == expected_string)
Beispiel #14
0
    def test_add_outcome_to_wheel_bin(self):
        """
        Tests that bins can be added to the wheel

        """
        self.wheel.add_outcome_to_wheel_bin(0, self.outcome_1)
        self.wheel.add_outcome_to_wheel_bin(0, self.outcome_2)
        self.wheel.add_outcome_to_wheel_bin(0, self.outcome_3)
        self.assertEqual(self.wheel.get_wheel_bin(0), self.bin1)

        self.wheel.add_outcome_to_wheel_bin(1, self.outcome_1)
        self.wheel.add_outcome_to_wheel_bin(1, self.outcome_3)
        self.wheel.add_outcome_to_wheel_bin(1, Outcome('00-0-1-2-3', 6))
        self.assertEqual(self.wheel.get_wheel_bin(1), self.bin2)
Beispiel #15
0
    def generate_split_bets(self, wheel):
        """
        Generates the split bets outcomes and adds them to the appropriate bins of the wheel

        """
        # left-right split bets
        for row in range(12):
            # Column 1-2 split
            first_column_number = (3 * row) + 1
            wheel.add_outcome_to_wheel_bin(
                first_column_number,
                Outcome(
                    "{" + "{} - {}".format(str(first_column_number),
                                           str(first_column_number + 1)) + "}",
                    17))
            wheel.add_outcome_to_wheel_bin(
                first_column_number + 1,
                Outcome(
                    "{" + "{} - {}".format(str(first_column_number),
                                           str(first_column_number + 1)) + "}",
                    17))

            # column 2-3 split
            second_column_number = (3 * row) + 2
            wheel.add_outcome_to_wheel_bin(
                second_column_number,
                Outcome(
                    "{" + "{} - {}".format(str(first_column_number),
                                           str(first_column_number + 1)) + "}",
                    17))
            wheel.add_outcome_to_wheel_bin(
                second_column_number + 1,
                Outcome(
                    "{" + "{} - {}".format(str(first_column_number),
                                           str(first_column_number + 1)) + "}",
                    17))

        # up-down split bets
        for number in range(1, 34):
            wheel.add_outcome_to_wheel_bin(
                number,
                Outcome(
                    "{" + "{} - {}".format(str(number), str(number + 3)) + "}",
                    17))
            wheel.add_outcome_to_wheel_bin(
                number + 3,
                Outcome(
                    "{" + "{} - {}".format(str(number), str(number + 3)) + "}",
                    17))
Beispiel #16
0
 def column_outcome(column_number):
     return Outcome(
         "{" + "{} - {} - {} - {} - {} - {}".format(
             str(column_number), str(column_number + 1),
             str(column_number + 2), str(column_number + 3),
             str(column_number + 4), str(column_number + 5)) + "}", 5)
Beispiel #17
0
    def setUp(self):
        """
        setup function for the TestOutcomeMethods class

        """
        self.outcome = Outcome('Red', 17)
Beispiel #18
0
    def generate_special_case_double_zero(self, wheel):
        """
        Creates an outcome from '00' and assigns it to bin 37 of the wheel

        """
        wheel.add_outcome_to_wheel_bin(37, Outcome('00', 35))