예제 #1
0
 def test_handle_seven_out(self):
     hw = CreateNewHardways(8, 5.0)
     simulator = CrapsSimulator()
     simulator.set_sample_data(np.array([[4, 6], [3, 4], [3, 3], [3, 4]]))
     simulator.add_bets(hw)
     simulator.simulate()
     self.assertEqual(
         2, len([x for x in simulator.events if x.id == Events.LOST_BET]))
예제 #2
0
 def test_handle_seven_always_working(self):
     hw = CreateNewHardways(8, 5.0, always_work=True)
     simulator = CrapsSimulator()
     simulator.set_sample_data(np.array([[4, 6], [5, 5], [4, 4], [4, 4]]))
     simulator.add_bets(hw)
     simulator.simulate()
     self.assertEqual(
         2,
         len([
             x for x in simulator.events if x.id == Events.COLLECT_WINNINGS
         ]))
예제 #3
0
 def test_handle_roll_lost(self):
     hw = CreateNewHardways(8, 5.0)
     simulator = CrapsSimulator()
     simulator.set_sample_data(np.array([[3, 3], [5, 3]]))
     simulator.add_bets(hw)
     simulator.simulate()
     self.assertEqual(
         1, len([x for x in simulator.events if x.id == Events.LOST_BET]))
     self.assertEqual(
         0,
         len([
             x for x in simulator.events if x.id == Events.COLLECT_WINNINGS
         ]))
예제 #4
0
 def test_point_made_lost_bet(self):
     hw = CreateNewHardways(8, 5.0, play_when_point_is_hard_way=True)
     simulator = CrapsSimulator()
     simulator.set_sample_data(np.array([[4, 4], [5, 3]]))
     simulator.add_bets(hw)
     simulator.simulate()
     self.assertEqual(
         1, len([x for x in simulator.events if x.id == Events.LOST_BET]))
     self.assertEqual(
         0,
         len([
             x for x in simulator.events if x.id == Events.COLLECT_WINNINGS
         ]))
예제 #5
0
 def test_multiple_wins_and_losses(self):
     hw = CreateNewHardways(8, 5.0)
     simulator = CrapsSimulator()
     simulator.set_sample_data(
         np.array([[3, 3], [5, 3], [2, 4], [2, 3], [4, 3], [4, 2], [4, 4],
                   [3, 3], [2, 3], [4, 4]]))
     simulator.add_bets(hw)
     simulator.simulate()
     self.assertEqual(
         2, len([x for x in simulator.events if x.id == Events.LOST_BET]))
     self.assertEqual(
         2,
         len([
             x for x in simulator.events if x.id == Events.COLLECT_WINNINGS
         ]))
예제 #6
0
 def test_event_flow(self):
     simulator = CrapsSimulator()
     simulator.set_sample_data(np.array([[4, 4], [3, 3], [3, 3], [3, 3]]))
     simulator.simulate()
     self.assertEqual([
         Events.NEW_SHOOTER, Events.ESTABLISH_POINT, Events.ROLL,
         Events.ROLL, Events.ROLL
     ], [x.id for x in simulator.events])
예제 #7
0
 def test_seven_out(self):
     simulator = CrapsSimulator()
     simulator.set_sample_data(
         np.array([[1, 2], [4, 4], [3, 4], [2, 3], [3, 4]]))
     simulator.simulate()
     self.assertEqual(
         2,
         len([x.id for x in simulator.events if x.id == Events.SEVEN_OUT]))
예제 #8
0
 def test_extend_hardways(self):
     t = TripleParleyHardWays()
     t.original_bet_amount = 5
     t.bet_amount = 5
     t.set_hard_way = 8
     t.play_when_point_is_hard_way = True
     simulator = CrapsSimulator()
     simulator.add_bets([t])
     simulator.generate_rolls(10000)
     results = simulator.simulate()
     print(
         f" money lost: {np.sum(results['shooters']['money_lost'])} money won: {np.sum(results['shooters']['money_won'])}"
     )
예제 #9
0
 def test_combination_builder(self):
     simulator = CrapsSimulator()
     self.assertEqual([[1, 6], [2, 5], [3, 4], [4, 3], [5, 2], [6, 1]],
                      simulator.combinations(7))
예제 #10
0
 def test_flip_established_point(self):
     simulator = CrapsSimulator()
     previous_value = simulator.is_point_established
     simulator.flip_established_point()
     self.assertNotEquals(previous_value, simulator.is_point_established)
예제 #11
0
 def test_establishing_point(self):
     simulator = CrapsSimulator()
     self.assertFalse(simulator.establishing_point(np.array([3, 4])))
     self.assertTrue(simulator.establishing_point(np.array([4, 4])))