Ejemplo n.º 1
0
 def test_collect_blinds(self):
     initial_stack = 1000
     small_blind_size = 5
     big_blind_size = small_blind_size * 2
     button_player = self.setup_new_player("Button", initial_stack)
     player2 = self.setup_new_player("SmallBlind", initial_stack)
     player3 = self.setup_new_player("BigBlind", initial_stack)
     seating = Seating([button_player, player2, player3])
     deck = Deck()
     dealer = Dealer(deck, seating)
     dealer.pot = Pot()
     dealer.collect_blinds(small_blind_size)
     self.assertEqual(initial_stack, button_player.stack)
     self.assertEqual(initial_stack - small_blind_size, player2.stack)
     self.assertEqual(initial_stack - big_blind_size, player3.stack)
     self.assertEqual(big_blind_size + small_blind_size,
                      dealer.pot.total_count())
     dealer.move_button()
     dealer.pot = Pot()
     dealer.collect_blinds(small_blind_size)
     self.assertEqual(initial_stack - big_blind_size, button_player.stack)
     self.assertEqual(initial_stack - small_blind_size, player2.stack)
     self.assertEqual(initial_stack - big_blind_size - small_blind_size,
                      player3.stack)
     self.assertEqual(big_blind_size + small_blind_size,
                      dealer.pot.total_count())
     self.assertTrue(button_player in dealer.pot.chips_per_player)
     self.assertTrue(player3 in dealer.pot.chips_per_player)
Ejemplo n.º 2
0
 def test_play_round__when_round_concludes___button_is_moved(self):
     stack_player1 = 100
     stack_player2 = 100
     player1 = self.setup_new_player("Player1", stack_player1)
     player2 = self.setup_new_player("Player2", stack_player2)
     player1.act = TestDealer.action_fold()
     player2.act = TestDealer.action_fold()
     seating = Seating([player1, player2])
     dealer = Dealer(None, seating)
     dealer.move_button = MagicMock()
     # draw for Button and SmallBlind, both have 2 pairs with same kicker
     round = Round(dealer)
     round.play_round(5)
     self.assertTrue(dealer.move_button.called)
Ejemplo n.º 3
0
 def test_move_button__when2players(self):
     initial_button_player = self.setup_new_player("Button", 100)
     initial_bb_player = self.setup_new_player("BigBlind", 100)
     seating = Seating([initial_button_player, initial_bb_player])
     deck = Deck()
     dealer = Dealer(deck, seating)
     dealer.move_button()
     seating.button_position = 0
     dealer.move_button()
     seating.button_position = 1
     dealer.move_button()
     seating.button_position = 0
Ejemplo n.º 4
0
 def test_move_button__when5players(self):
     player1 = self.setup_new_player("Player1", 100)
     player2 = self.setup_new_player("Player2", 100)
     initial_button_player = self.setup_new_player("Button", 100)
     initial_sb_player = self.setup_new_player("SmallBlind", 100)
     initial_bb_player = self.setup_new_player("BigBlind", 100)
     seating = Seating([
         player1, player2, initial_button_player, initial_sb_player,
         initial_bb_player
     ])
     deck = Deck()
     dealer = Dealer(deck, seating)
     dealer.move_button()
     seating.button_position = 0
     dealer.move_button()
     seating.button_position = 1
     dealer.move_button()
     seating.button_position = 2
     dealer.move_button()
     seating.button_position = 3
     dealer.move_button()
     seating.button_position = 4
     dealer.move_button()
     seating.button_position = 5
     dealer.move_button()
     seating.button_position = 0