def test_verify(self): self.assertRaises( ValueError, NoLimitTexasHoldEm, Stakes(1, (1, 2)), (), ) self.assertRaises( ValueError, NoLimitTexasHoldEm, Stakes(1, (1, 2)), (1, ), ) self.assertRaises( ValueError, NoLimitTexasHoldEm, Stakes(1, (1, 2, 4, 8)), ( 100, 100, 100, ), ) self.assertRaises(ValueError, NoLimitTexasHoldEm, Stakes(1, (1, 2)), ( 100, -100, -100, ))
def test_hands(self): self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4), 5, 10), (100, 100), ).act( 'dh QdQh', 'dh AhAd', 'br', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'br', 'cc', 'db Qc', 'cc', 'cc', 's', 's', ), (True, True), (80, 120)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4), 5, 10), (100, 100), ).act( 'dh AhAd', 'dh QdQh', 'br', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', 's', 's', ), (True, False), (110, 90)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4), 5, 10), (100, 100), ).act( 'dh AhAd', 'dh QdQh', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'br', 'cc', 'db Qc', 'cc', 'cc', 's', 's 1', ), (True, True), (115, 85)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4), 5, 10), (100, 100), ).act( 'dh AhAd', 'dh QdQh', 'br', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', 's 0', ), (False, None), (90, 110))
def test_hands(self): self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (200, 200), ).act( 'dh AcKcQcJcTc2c', 'dh AsKsQsJsTs2s', 'br 6', 'br 18', 'cc', 'db 9s8s7s', 'cc', 'cc', 'db 6s', 'br 30', 'cc', 'db 6c', 'cc', 'br 50', 'cc', 's 1', 's', ), (False, True), (102, 298)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2, 4, 8)), (500,) * 6, ).act( 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'br 25', 'f', 'f', 'cc', 'cc', 'cc', 'db', 'cc', 'cc', 'cc', 'br 80', 'cc', 'cc', 'f', 'db', 'br 225', 'cc', 'f', 'db', 'cc', 'br 170', 'f', ), (False, False, None, False, False, False), ( 499, 170, 961, 475, 395, 500, )) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2, 0, 2)), (200,) * 6, ).act( 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'br 9', 'f', 'f', 'br 25', 'cc', 'cc', 'cc', 'db', 'cc', 'cc', 'cc', 'br 75', 'cc', 'cc', 'f', 'db', 'br 100', 'f', 'f', ), (None, False, False, False, False, False), ( 427, 100, 175, 198, 200, 100, )) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2, 2, 0, 2)), (200,) * 6, ).act( 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'cc', 'cc', 'cc', 'br 9', 'br 25', 'f', 'f', 'cc', 'cc', 'cc', 'db', 'cc', 'cc', 'cc', 'br 75', 'cc', 'cc', 'f', 'db', 'br 100', 'f', 'f', ), (None, False, False, False, False, False), ( 429, 198, 198, 100, 175, 100, ))
def test_hands(self): super().test_hands() self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (5, 10)), (1000, 1000, 1000, 1000), ).act( 'dh AsAdAcAhKd', 'dh 4s4d4c5h5d', 'dh 2s2d2c3h3d', 'dh Th8h9cJsQd', 'cc', 'cc', 'f', 'cc', 'dd 4c4d4s 5c5sKc', 'dd 3h3d 2hQs', 'dd', 'br 100', 'cc', 'cc', 's', 's', 's', ), (False, True, False, False), (995, 1225, 890, 890)) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(1, ()), (100, 100, 100, 100), ).act( 'dh 8cKdJd2h5d', 'dh JsAd3d4d7c', 'dh 2c5sTsQsAs', 'dh AcAh8s9c3s', 'br 5', 'f', 'cc', 'cc', 'dd Jd2h5d Jc6s7d', 'dd 2c Ks', 'dd 8s9c3s KhKcTh', 'cc', 'cc', 'br 10', 'f', 'br 20', 'cc', 's', 's', ), (False, False, True, False), (94, 99, 133, 74))
def test_hands(self): self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (75, 150)), (1180, 4340, 5910, 10765), ).act( 'dh 7h6c4c3d2c', 'dh JsJcJdJhTs', 'dh KsKcKdKhTh', 'dh AsQs6s5c3c', 'f', 'br 300', 'br 450', 'f', 'cc', 'dd', 'dd AsQs 2hQh', 'br 150', 'cc', 'dd', 'dd Qh 4d', 'br 300', 'cc', 'dd', 'dd 6s 7c', 'br 280', 'cc', ), (True, False, False, True), (0, 4190, 5910, 12095))
def _modify(self): super()._modify() seats = self.seats for seat in self.table.seats: if seat.is_player(): seat.user.refresh_from_db() seat.user.payoff += seat.player.payoff seat.user.play_count += 1 seat.user.save() for seat in self.table.seats: if not seat.is_playable(): self.table.seating[seat.ordinal] = None for seat in self.table.seats: if seat.is_player(): if seat.buy_in_amount is None: seat.buy_in_amount = seat.player.stack seat.player = None self.table.game = NoLimitTexasHoldEm( Stakes(1, (1, 2)), map(attrgetter('buy_in_amount'), seats), ) for seat, player in zip(seats, self.table.game.players): seat.buy_in_amount = None seat.player = player
def play_round(config, algo_a, algo_b, verbose=False, bkwrd=False): stakes = Stakes(0, config['blinds']) starting_stacks = config['starting_stacks'] game = FixedLimitTexasHoldEm(stakes, starting_stacks) gamestate = GameState(game) def do_player_turn(player, algo, name): #assumes this player is the actor if player.can_showdown(): player.showdown() else: move = algo(player, gamestate) if verbose: print(f"player {name} declares {move}") if move == 'fold': player.fold() elif move == 'call': player.check_call() elif move == 'raise': player.bet_raise() else: raise Exception(f'bad action {move}') gamestate.add_event(Event(name, move)) gamestate.pot = game.pot def do_nature(nature, p1, p2, game): #assume nature is actor gamestate.itt_street() if nature.can_deal_hole(): if verbose: print(f"deals holes") nature.deal_hole() gamestate.add_event(Event('nature', 'deal_p1', p1.hole)) nature.deal_hole() gamestate.add_event(Event('nature', 'deal_p2', p2.hole)) elif nature.can_deal_board(): if verbose: print(f"deals board") nature.deal_board() gamestate.add_event(Event('nature', 'deal_board', game.board)) p1, p2 = game.players nature = game.nature while not game.is_terminal(): if nature.is_actor(): do_nature(nature, p1, p2, game) elif p1.is_actor(): do_player_turn(p1, algo_a, 'p1') elif p2.is_actor(): do_player_turn(p2, algo_b, 'p2') return EndState(gamestate, p1, p2, bkwrd=bkwrd)
def test_hands(self): self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (50000, 100000)), (125945025, 67847350), ).act( 'dh Ah3sKsKh', 'dh 6d9s7d8h', 'br 300000', 'br 900000', 'br 2700000', 'br 8100000', 'cc', 'db 4s5c2h', 'br 9100000', 'br 43500000', 'br 77900000', 'cc', 'db 5h', 'db 9c', ), (True, True), (193792375, 0))
def test_bet_raise_when_max_count(self): game = NoLimitTexasHoldEm(Stakes(1, ()), (101, 101)).act('dh', 'dh') for _ in range(100): game.actor.bet_raise() self.assertFalse(game.actor.can_bet_raise()) game = PotLimitOmahaHoldEm(Stakes(1, ()), (101, 101)).act('dh', 'dh') for _ in range(100): game.actor.bet_raise() self.assertFalse(game.actor.can_bet_raise()) game = FixedLimitTexasHoldEm(Stakes(1, (1, 2)), (101, 101)).act( 'dh', 'dh', ) for _ in range(3): game.actor.bet_raise() self.assertFalse(game.actor.can_bet_raise()) game.actor.check_call() for _ in range(3): game.actor.deal_board() for _ in range(4): game.actor.bet_raise() self.assertFalse(game.actor.can_bet_raise()) game.actor.check_call()
def test_hands(self): self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(1, (2, 5), small_bet=10), (100, 100), ).act( 'dh AhAc', 'dh AsKs', 'br', 'cc', 'db KcQdJh', 'br', 'cc', 'db Tc', 'br', 'cc', 'db 9d', 'cc', 'cc', 's', 's', ), (True, True), (64, 136))
def test_hands(self): self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (50000, 100000)), (125945025, 67847350), ).act( 'dh Ah3sKsKh2c', 'dh 6d9s7d8h2d', 'cc', 'cc', 'db 4s5c2h', 'cc', 'cc', 'db 5h', 'cc', 'cc', 'db 9c', 'cc', 'cc', 's', 's', ), (True, False), (126045025, 67747350))
def test_hands(self): self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (5, 10)), (1000, 1000, 1000, 1000), ).act( 'dh AsAdAcAhKd', 'dh 4s4d4c5h5d', 'dh 2s2d2c3h3d', 'dh Th8h9cJsQd', 'cc', 'cc', 'f', 'cc', 'dd 4c4d4s 5c5sKc', 'dd 3h3d 2hQs', 'dd', 'br 35', 'cc', 'cc', 's', 's', 's', ), (False, True, False, False), (995, 1095, 955, 955))
def test_hands(self): super().test_hands() self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(1, (2, 5)), (100, 100), ).act( 'dh AhAc', 'dh AsKs', 'br', 'cc', 'db KcQdJh', 'br', 'cc', 'db Tc', 'br', 'cc', 'db 9d', 'cc', 'cc', 's', 's', ), (True, True), (79, 121))
def test_hands(self): self.assert_terminal_poker_game( self.GAME_TYPE(Stakes(3, {-1: 3}), ( 495, 232, 362, 403, 301, 204, )).act( 'dh Th8h', 'dh QsJd', 'dh QhQd', 'dh 8d7c', 'dh KhKs', 'dh 8c7h', 'cc', 'cc', 'br 35', 'f', 'br 298', 'f', 'f', 'f', 'cc', 'db 9h6cKc', 'db Jh', 'db Ts', ), (False, False, True, False, True, False), ( 489, 226, 684, 400, 0, 198, ))
def create_game(self): return self.GAME_TYPE( Stakes(1, (1, 2)), tuple(randint(0, 50) for _ in range(randint(2, 6))))
def test_hands(self): self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'br 199', 'cc', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (100, 200)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 99', 'cc', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (100, 200)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', 's', 's', ), (True, True), (193, 107)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', 's', 's', ), (True, True), (197, 103)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 4', 'cc', 'db AcAsKc', 'br 6', 'f', ), (None, False), (205, 95)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (0, 0), ).act( 'dh QdQh', 'dh AhAd', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (0, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (1, 0), ).act( 'dh QdQh', 'dh AhAd', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (1, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (0, 1), ).act( 'dh QdQh', 'dh AhAd', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (0, 1)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (2, 1), ).act( 'dh QdQh', 'dh AhAd', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (1, 2)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (50, 1), ).act( 'dh QdQh', 'dh AhAd', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True), (49, 2)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(500, (1000, 2000)), (1125600, 2000000, 553500), ).act( 'dh Ac2d', 'dh 5h7s', 'dh 7h6h', 'br 7000', 'br 23000', 'f', 'cc', 'db Jc3d5c', 'br 35000', 'cc', 'db 4h', 'br 90000', 'br 232600', 'br 1067100', 'cc', 'db Jh', ), (True, False, True), (572100, 1997500, 1109500)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (100, 100, 100), ).act( 'dh AhTh', 'dh AsTs', 'dh AcTc', 'br 6', 'f', 'cc', 'db 2h3h4h', 'cc', 'cc', 'db 4s', 'br 93', 'cc', 'db 5s', ), (False, True, True), (98, 101, 101)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'br 299', 'cc', 'cc', 'cc', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True, True, True), (300, 400, 100, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'br 6', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 's', 's', 's', ), (True, True, False, False), (193, 115, 299, 193)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'br 6', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'br 10', 'br 20', 'cc', 'f', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'br 50', 'cc', 's', 's', ), (False, True, False, False), (123, 195, 299, 183)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'br 6', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'br 10', 'br 20', 'cc', 'br 93', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 's', 's', 's', 's', ), (True, True, False, False), (100, 400, 200, 100)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'br 6', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'br 10', 'br 20', 'cc', 'br 93', 'cc', 'cc', 'cc', 'db Qs', 'br 50', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 's', 's', 's', 's', ), (True, True, False, False), (200, 400, 150, 50)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'br 199', 'cc', 'cc', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True, False, True), (200, 301, 299, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (100,) * 4, ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'br 99', 'cc', 'cc', 'cc', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True, True, True), (0, 400, 0, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (0, 0, 0, 0), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True, True, True), (0, 0, 0, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (1, 1, 5, 5), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'br 4', 'cc', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True, True, True), (0, 4, 8, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (7, 0, 9, 7), ).act( 'dh 4h8s', 'dh AsQs', 'dh Ac8d', 'dh AhQh', 'f', 'f', 'db Ad3s2h', 'db 8h', 'db Ts', ), (True, True, False, False), (9, 0, 8, 6)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (1, 17, 0, 1), ).act( 'dh 3d6c', 'dh 8sAh', 'dh Ad8c', 'dh KcQs', 'db 4c7h5s', 'db Ts', 'db 3c', ), (True, True, True, True), (3, 16, 0, 0)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (2, 16, 0, 1), ).act( 'dh AcKs', 'dh 8h2c', 'dh 6h6c', 'dh 2dTd', 'db 8d5c4d', 'db Qh', 'db 5d', ), (True, True, True, True), (0, 16, 0, 3)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200, 200, 150), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'dh JcJh', 'dh TsTh', 'cc', 'cc', 'cc', 'br 149', 'cc', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 'cc', 's', 's', 's', 's', 's', 's', ), (True, True, False, False, False, False), ( 300, 600, 150, 50, 50, 0, )) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200, 200, 150), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'dh JcJh', 'dh TsTh', 'br 50', 'f', 'f', 'f', 'f', 'f', ), (False, False, None, False, False, False), ( 198, 97, 308, 199, 199, 149, )) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (200, 100, 300, 200, 200, 150), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'dh TsTh', 'dh JcTc', 'br 50', 'br 199', 'cc', 'cc', 'cc', 'cc', 'f', 'db AcAsKc', 'db Qs', 'db Qc', ), (True, True, False, True, True, True), ( 150, 0, 249, 0, 0, 751, ))
def test_hands(self): self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (1, 2)), (200, 200), ).act( 'dh 2s3h4s6d7d', 'dh 2h3c4d7c8d', 'br 6', 'br 12', 'br 18', 'br 36', 'br 72', 'cc', 'dd', 'dd 8d 5c', 'br 128', 'cc', ), (True, True), (0, 400)) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(1, (1, 2)), (200, 200, 100), ).act( 'dh 2s3h4s6d7d', 'dh 2h3c4d7c8d', 'dh 2d3d4c5d7h', 'br 6', 'br 18', 'br 54', 'br 99', 'br 199', 'cc', 'dd', 'dd', 'dd', ), (True, True, True), (200, 0, 300)) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(15, (15, 30)), (1015, 2530, 1955), ).act( 'dh AsTc9c6h3s', 'dh 9dThJsQsKs', 'dh 4s4d4c3h3c', 'br 100', 'br 300', 'f', 'cc', 'dd As 5h', 'dd', 'cc', 'br 700', 'f', ), (False, False, None), (700, 2485, 2315)) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(1, (1, 2)), (200, 200, 100, 150), ).act( 'dh 2s3h4s6d7d', 'dh 2h3c4d7c8d', 'dh 2d3d4c5d7h', 'dh KcKdKhKsQc', 'br 6', 'f', 'cc', 'cc', 'dd 6d 9c', 'dd 8d 8c', 'dd', 'cc', 'cc', 'br 30', 'cc', 'cc', 's', 's', 's', ), (False, False, True, False), (163, 163, 175, 149)) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(8750, (10000, 25000)), (1180000, 1065000, 870000, 2345000), ).act( 'dh As6h6d2h2d', 'dh KhTs6c5d4c', 'dh AhKsQhJhTh', 'dh AdKcQcJcTc', 'f', 'f', 'br 100000', 'cc', 'dd', 'dd Kh 4h', 'br 150000', 'cc', 's', 's', ), (True, True, False, False), (921250, 1341250, 861250, 2336250)) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (1, 2, 4)), (50, 2, 100, 150, 100, 100), ).act( 'dh AcAdAhAsJc', 'dh 2h3c4d7c8d', 'dh 2d3d4c5d7h', 'dh KcKdKhKsJd', 'dh QcQdQhQsJh', 'dh 7s8c9cTcJs', 'f', 'f', 'f', 'f', 'dd 8d 6s', 'dd', ), (False, True, True, False, False, False), ( 49, 0, 103, 150, 100, 100, )) self.assert_terminal_poker_game( self.GAME_TYPE( Stakes(0, (1, 2, 4)), (50, 2, 100, 150, 100, 100, 1, 1, 1), ).act( 'dh AcAdAhAsJc', 'dh 2h3c4d7c8d', 'dh 2d3d4c5d7h', 'dh KcKdKhKsJd', 'dh QcQdQhQsJh', 'dh 7s8c9cTcJs', 'dh', 'dh', 'dh', 'f', 'f', 'f', 'f', 'f', 'f', 'f', 'dd', 'dd', ), (False, True, True, False, False, False, False, False, False), ( 49, 0, 103, 150, 100, 100, 1, 1, 1, ))
def test_bet_raise_amounts(self): game = NoLimitTexasHoldEm(Stakes(0, (5, 10)), (1000, 1000)).act( 'dh', 'dh', ) self.assertEqual(game.actor.bet_raise_min_amount, 20) self.assertEqual(game.actor.bet_raise_max_amount, 1000) self.assertEqual(game.actor.bet_raise_pot_amount, 30) game.act('cc', 'cc') for _ in range(3): game.act('db') self.assertEqual(game.actor.bet_raise_min_amount, 10) self.assertEqual(game.actor.bet_raise_max_amount, 990) self.assertEqual(game.actor.bet_raise_pot_amount, 20) game.act('cc', 'cc') game = PotLimitOmahaHoldEm(Stakes(0, (5, 10)), (1000, 1000)).act( 'dh', 'dh', ) self.assertEqual(game.actor.bet_raise_min_amount, 20) self.assertEqual(game.actor.bet_raise_max_amount, 30) self.assertEqual(game.actor.bet_raise_pot_amount, 30) game.act('br 25') self.assertEqual(game.actor.bet_raise_min_amount, 40) self.assertEqual(game.actor.bet_raise_max_amount, 75) self.assertEqual(game.actor.bet_raise_pot_amount, 75) game.act('cc') for _ in range(3): game.act('db') self.assertEqual(game.actor.bet_raise_min_amount, 10) self.assertEqual(game.actor.bet_raise_max_amount, 50) self.assertEqual(game.actor.bet_raise_pot_amount, 50) game.act('cc', 'cc') game = FixedLimitTexasHoldEm(Stakes(0, (5, 10)), (1000, 1000)).act( 'dh', 'dh', ) self.assertEqual(game.actor.bet_raise_min_amount, 20) self.assertEqual(game.actor.bet_raise_max_amount, 20) self.assertEqual(game.actor.bet_raise_pot_amount, 20) game.act('cc', 'cc', 'db') self.assertEqual(game.actor.bet_raise_min_amount, 10) self.assertEqual(game.actor.bet_raise_max_amount, 10) self.assertEqual(game.actor.bet_raise_pot_amount, 10) game.act('br') self.assertEqual(game.actor.bet_raise_min_amount, 20) self.assertEqual(game.actor.bet_raise_max_amount, 20) self.assertEqual(game.actor.bet_raise_pot_amount, 20) game.act('cc') for _ in range(2): game.act('db') self.assertEqual(game.actor.bet_raise_min_amount, 20) self.assertEqual(game.actor.bet_raise_max_amount, 20) self.assertEqual(game.actor.bet_raise_pot_amount, 20) game.act('br') self.assertEqual(game.actor.bet_raise_min_amount, 40) self.assertEqual(game.actor.bet_raise_max_amount, 40) self.assertEqual(game.actor.bet_raise_pot_amount, 40) game.act('br') self.assertEqual(game.actor.bet_raise_min_amount, 60) self.assertEqual(game.actor.bet_raise_max_amount, 60) self.assertEqual(game.actor.bet_raise_pot_amount, 60) game.act('cc')
def test_showdown_opener(self): self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', ).actor.index, 0) self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', ).actor.index, 0) self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'br 4', 'cc', 'db Qc', 'cc', 'cc', ).actor.index, 0) self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'br 6', 'br 12', 'cc', ).actor.index, 0) self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 'cc', ).actor.index, 0) self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'br 2', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 'cc', ).actor.index, 0) self.assertEqual( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'cc', 'db Qc', 'br 6', 'br 12', 'br 150', 'cc', 'cc', 'cc', ).actor.index, 2)
def test_bet_raise_with_invalid_amount(self): self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', ).can_act('br 9')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', ).can_act('br 1000')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'cc', 'db AcAsKc', 'br 12', 'br 24', ).can_act('br 30')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'br 4', 'cc', 'db AcAsKc', 'br 4', 'cc', 'db Qs', 'br 4', 'br 8', ).can_act('br 10')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', ).can_act('br 1')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'cc', 'br 98', 'br 99', ).can_act('br 100')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'br 2', 'br 4', 'br 6', 'br 8', 'cc', ).can_act('br 9')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'br 96', 'br 97', ).can_act('br 98')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'f', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'br 50', ).can_act('br 55'))
def test_bet_raise_when_irrelevant(self): self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 99', ).can_act('br 197')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'cc', 'db AcAsKc', 'cc', 'br 93', ).can_act('br 193')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'br 4', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'br 95', ).can_act('br 195')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'br 6', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'br 93', ).can_act('br 193')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'br 99', 'cc', 'br 199', 'cc', ).can_act('br 299')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'br 6', 'f', 'cc', 'db AcAsKc', 'br 93', ).can_act('br 193')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'f', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'db Qs', 'br 197', 'cc', ).can_act('br 297')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'f', 'f', 'cc', 'db AcAsKc', 'br 10', 'cc', 'db Qs', 'br 10', 'br 20', 'cc', 'db Qc', 'br 67', ).can_act('br 267'))
def test_fold_when_redundant(self): self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'br 4', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'br 4', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'br 6', 'f', 'f', 'cc', 'db AcAsKc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'f', 'f', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', ).can_act('f'))
def test_betting_action_when_not_betting_stage(self): self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'br 2', 'cc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act( 'dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'cc', ).can_act('cc')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100), ).act('dh QdQh', 'dh AhAd', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'db Qc', 'cc', 'br 2', 'br 4', 'cc').can_act('br 100')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 'br 2', 'cc', 'cc', 'cc', ).can_act('f')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 'cc', ).can_act('cc')) self.assertFalse( NoLimitTexasHoldEm( Stakes(1, (1, 2)), (200, 100, 300, 200), ).act( 'dh QdQh', 'dh AhAd', 'dh KsKh', 'dh JsJd', 'cc', 'cc', 'cc', 'cc', 'db AcAsKc', 'cc', 'cc', 'cc', 'cc', 'db Qs', 'cc', 'cc', 'cc', 'cc', 'db Qc', 'cc', 'cc', 'cc', 'br 2', 'br 4', 'br 6', 'cc', 'cc', 'cc', ).can_act('br 8'))
def test_draw_muck(self): game = PotLimitTripleDrawLowball27( Stakes(0, (1, 2)), (100, ) * 4, ).act( 'dh AcKcQcJcTc', 'dh AdKdQdJdTd', 'dh AhKhQhJhTh', 'dh AsKsQsJsTs', 'cc', 'cc', 'cc', 'cc', 'dd AcKcQcJcTc 9c8c7c6c5c', 'dd AdKdQdJdTd 9d8d7d6d5d', 'dd AhKhQhJhTh 9h8h7h6h5h', 'dd AsKsQsJsTs 9s8s7s6s5s', 'cc', 'cc', 'cc', 'cc', 'dd 9c8c7c6c5c 4c4d4h4s2c', ) self.assertTrue(game.actor.can_discard_draw()) self.assertTrue(game.actor.can_discard_draw(())) self.assertTrue(game.actor.can_discard_draw((), ())) self.assertTrue( game.actor.can_discard_draw( parse_cards('9d'), parse_cards('3c'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9d8d7d'), parse_cards('3c3d3h'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9d8d7d6d5d'), parse_cards('3c3d3h3s2d'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9d'), parse_cards('9c'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9d8d7d'), parse_cards('9c8c7c'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9d8d7d6d5d'), parse_cards('9c8c7c6c5c'), )) game.actor.discard_draw( parse_cards('9d8d7d6d5d'), parse_cards('3c3d3h3s2d'), ) self.assertTrue(game.actor.can_discard_draw()) self.assertTrue(game.actor.can_discard_draw(())) self.assertTrue(game.actor.can_discard_draw((), ())) self.assertTrue( game.actor.can_discard_draw( parse_cards('9h'), parse_cards('2s'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9h8h'), parse_cards('2s2h'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h'), parse_cards('Ac'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h8h'), parse_cards('AcKc'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9h8h7h'), parse_cards('AcKcQc'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9h8h7h6h5h'), parse_cards('AcKcQcJcTc'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9h8h7h'), parse_cards('2s2hQc'), )) self.assertTrue( game.actor.can_discard_draw( parse_cards('9h8h7h6h5h'), parse_cards('2s2hQcJcTc'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h'), parse_cards('Ah'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h8h'), parse_cards('AhKh'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h8h7h'), parse_cards('AhKhQh'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h8h7h6h5h'), parse_cards('AhKhQhJhTh'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h8h7h'), parse_cards('2s2hQh'), )) self.assertFalse( game.actor.can_discard_draw( parse_cards('9h8h7h6h5h'), parse_cards('2s2hQhJhTh'), )) game.actor.discard_draw( parse_cards('9h8h7h6h5h'), parse_cards('AcKcQcJcTc'), )
def test_bets(self): self.assertEqual(Stakes(0, (1, 2)).small_bet, 2) self.assertEqual(Stakes(0, (1, 2)).big_bet, 4) self.assertEqual(Stakes(1, ()).small_bet, 1) self.assertEqual(Stakes(1, ()).big_bet, 2) self.assertEqual(Stakes(0, (1, 2, 0, 2, 2)).small_bet, 2) self.assertEqual(Stakes(0, (1, 2, 0, 2, 2)).big_bet, 4) self.assertEqual(Stakes(5, (1, 2, 0, 2, 2)).small_bet, 5) self.assertEqual(Stakes(5, (1, 2, 0, 2, 2)).big_bet, 10) self.assertEqual( Stakes(5, (1, 2, 0, 2, 2), small_bet=10).small_bet, 10, ) self.assertEqual(Stakes(5, (1, 2, 0, 2, 2), small_bet=10).big_bet, 20) self.assertEqual( Stakes(5, (1, 2, 0, 2, 2), small_bet=10, big_bet=25).big_bet, 25, )
def test_hands(self): self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'br', 'f', ), (False, None), (97, 103)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (50, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'cc', 'cc', 'dd KhQs Ac2c', 'dd 8d9d 8h9h', 'br', 'br', 'f', ), (False, None), (46, 104)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (100, 50), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'cc', 'cc', 'dd KhQs Ac2c', 'dd 8d9d 8h9h', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'f', ), (None, False), (114, 36)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (100, 50), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'cc', 'cc', 'dd KhQs Ac2c', 'dd 8d9d 8h9h', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'f', ), (None, False), (118, 32)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'cc', 'cc', 'dd KhQs Ac2c', 'dd 8d9d 8h9h', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'cc', 'dd', 'dd', 'cc', 'cc', 's', 's', ), (True, True), (82, 118)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2, 4)), (100, 100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'f', 'f', ), (False, False, None), (98, 97, 105)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (50, 100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'cc', 'f', 'cc', 'dd 8d9d 8h9h', 'dd Kc Ac', 'br', 'br', 'f', ), (False, False, None), (49, 96, 105)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4)), (50, 100, 50), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'br', 'f', 'cc', 'dd 8d9d 8h9h', 'dd Kc Ac', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'br', 'f', ), (False, False, None), (47, 59, 94)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4)), (50, 100, 50), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'br', 'f', 'cc', 'dd', 'dd', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'br', 'cc', 'dd 8d9d 8h9h', 'dd Kc Ac', 'br', 'f', ), (False, None, False), (47, 152, 1)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4)), (50, 100, 50), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'br', 'f', 'cc', 'dd', 'dd', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'br', 'cc', 'dd 8d9d 8h9h', 'dd Kc Ac', 'br', 'cc', ), (False, True, True), (47, 50, 103)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2, 4)), (100, 100, 100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'dh 2s4c6dJc', 'f', 'f', 'f', ), (False, False, None, False), (98, 97, 106, 99)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (50, 100, 100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'dh 2s4c6dJc', 'f', 'f', 'cc', 'cc', 'dd KhQs As2h', 'dd', 'br', 'f', ), (None, False, False, False), (52, 98, 100, 100)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4)), (50, 100, 50, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'dh 2s4c6dJc', 'br', 'cc', 'f', 'f', 'dd', 'dd', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'br', 'f', ), (False, False, False, None), (47, 95, 9, 149)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (2, 4)), (50, 100, 50, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'dh 2s4c6dJc', 'br', 'cc', 'f', 'f', 'dd', 'dd', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'f', ), (False, False, None, False), (47, 95, 107, 51)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(0, (1, 2)), (100, 100, 100, 100), ).act( 'dh KhQs9cTs', 'dh 4s5d8d9d', 'dh KcTc8s3h', 'dh 2s4c6dJc', 'f', 'cc', 'cc', 'cc', 'dd Kh9c Qh7s', 'dd 8d9d 7c8h', 'dd Jc Th', 'cc', 'br', 'cc', 'cc', 'dd Qs Js', 'dd', 'dd Th 9h', 'cc', 'br', 'br', 'f', 'cc', 'dd 4s 3s', 'dd', 'cc', 'br', 'cc', 's', 's', ), (False, True, False, True), (96, 120, 100, 84)) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2, 4, 8, 16)), (100, 50, 100, 50, 100, 50), ).act( 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'f', 'f', 'cc', 'cc', 'cc', 'cc', 'dd', 'dd', 'dd', 'dd', 'cc', 'br', 'cc', 'f', 'f', 'dd', 'dd', 'br', 'f', ), (False, False, None, False, False, False), ( 98, 33, 170, 17, 83, 49, )) self.assert_terminal_poker_game(self.GAME_TYPE( Stakes(1, (1, 2)), (50, 50, 50, 50, 50, 50, 50, 50, 50), ).act( 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'dh', 'f', 'f', 'f', 'br', 'cc', 'f', 'f', 'f', 'cc', 'dd', 'dd', 'dd', 'cc', 'br', 'cc', 'f', 'dd', 'dd', 'cc', 'br', 'br', 'cc', 'dd', 'dd', 'br', 'br', 'br', 'f', ), (False, False, False, False, False, None, False, False, False), ( 48, 45, 49, 49, 49, 85, 27, 49, 49, ))