def __init__(self, players: list): #List of all players (This is needed because deque will be modified) self.playerNames = players self.Deck = Poker.Deck() self.players = collections.deque(players, 4) #Leaderboard '''self.Leaderboard = { playerNames[0]: 0, playerNames[1]: 0, playerNames[2]: 0, playerNames[3]: 0, }''' #output file self.OUTPUT_FILE = open(FILEPATH, 'w') #Variable to determine if hearts have been broken self.HeartsBroken = False #shuffle the deck before play #self.Deck.shuffle() print("Hearts game starts with {} players".format(len(self.players))) #Show who's playing for player in self.players: print("Player {} : {}".format( players.index(player) + 1, player.name))
def test_deck_size(self): deck = Poker.Deck() hand = Poker.Hand(deck, 2) self.assertEqual(len(deck.cardList), 50)
def test_draw_card(self): deck = Poker.Deck() deck.drawCard() self.assertEqual(len(deck.cardList), 51)
def test_hand_size(self): deck = Poker.Deck() hand = Poker.Hand(deck, 2) self.assertEqual(len(hand.cards), 2)
def test_deck_size(self): self.assertEqual(len(Poker.Deck().cardList), 52)