def test_figures_out_own_best_hand(self):
        mock_hand = MagicMock()
        player = Player(name="Oleks", hand=mock_hand)

        player.best_hand()
        mock_hand.best_rank.assert_called()
Beispiel #2
0
from poker import Card, Deck, Hand, Player, GameRound

deck = Deck()
deck.add_cards(Card.create_52_cards())

hand1 = Hand()
hand2 = Hand()

player1 = Player("Oleks", hand1)
player2 = Player("Lexa", hand2)

game_round = GameRound(deck, [player1, player2])
game_round.play()

print(player1.best_hand())
print(player2.best_hand())
print(player1.hand)
print(len(deck))

# def ranks_with_count(cards, count):
#     return {
#         rank: rank_count
#         for rank, rank_count in card_rank_count(cards).items()
#         if rank_count == count
#     }
#
#
# def card_rank_count(cards):
#     card_rank_count = {}
#     for card in cards:
#         card_rank_count.setdefault(card.rank, 0)