I'm a beginner at pyhton. i'm working on a poker game. currently i'm stuck at dealing every player two cards. dealing the flop, turn and river work fine but dealing the player cards doesn't work. I don't understand why it doesn't work. Any solutions, explanation, other approaches advice are appreciated. Link to my github with the full code Github
def deal(self, location, times=1):
for i in range(times):
location.cards.append(self.pop(0))
def deal_hole(self):
count = 0
while count < 2:
for player in self.players_not_out:
self.deck.deal(player, 1)
count += 1
The Deal_hole method should append two cards to all the player class instances at the attribute cards which is a list, but it returns a empty list. i used the following code to test the method
list_of_players = [player('a'), player('b'), player('c'), player('d')]
game = game('q')
deck = deck()
a = player('a')
b = player('b')
c = player('c')
d = player('d')
game.shuffle_deck()
game.deal_hole()
player.show_hand(a,a)
This returned: a's hand: []