Esempio n. 1
0
 def _create_players(self, number):
     names = Names()
     self.hide_player_buttons()
     self._root.update()
     deck = CardDeck()
     cards = Card.create_cards()
     deck.add_cards(cards)
     hand = Hand()
     player = Player(f"Player", hand)
     self._players.append(player)
     human = Human(player=player, gui=self)
     for i in range(number):
         hand = Hand()
         # player = Player(f"Opponent {i + 1}", hand)
         player = Player(names.get_random_name(), hand)
         self._players.append(player)
         ai = AI(player=player)
     self.hide_player_buttons()
     for player in self._players:
         player.add_chips(60)
     game = GameRound(players=self._players, deck=deck, gui=self)
     # game.set_game_qty(game_qty=10)
     game.set_game_qty(infinite=True)
     game.play()
     self.stop()
 def test_deal(self):
     card_deck = CardDeck()
     cards = Card.create_cards()
     card_deck.add_cards(cards)
     cards_a = card_deck.deal_cards(2)
     cards_b = cards[:2]
     self.assertEqual(cards_a, cards_b)
     cards_a = card_deck.cards
     del cards[:2]
     cards_b = cards
     self.assertEqual(cards_a, cards_b)
Esempio n. 3
0
def create_players(number):
    deck = CardDeck()
    cards = Card.create_cards()
    deck.add_cards(cards)
    hand = Hand()
    player = Player(f"Player", hand)
    players.append(player)
    human = Human(player=player)
    for i in range(number):
        hand = Hand()
        player = Player(f"Opponent {i}", hand)
        players.append(player)
        ai = AI(player=player)
    hide_buttons()
    for player in players:
        player.add_chips(60)
    game = GameRound(players=players, deck=deck)
    # game.set_game_qty(game_qty=10)
    game.set_game_qty(infinite=True)
    game.play()
 def test_all_cards(self):
     self.assertEqual(
         len(Card.RANKS) * len(Card.SUITS), len(Card.create_cards()))