-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dealer.py
43 lines (35 loc) · 1.07 KB
/
Dealer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from Agent import Agent as Parent
class Dealer(Parent):
'''
This class represents a Dealer object and extends the Agent
class. Each dealer can deal, collect, or payout.
'''
def __init__(self):
'''
Calls the super constructor of the Agent class
'''
super().__init__()
def deal(self, player, deck):
'''
Deals a card to player
Parameters:
player (Player): the player being dealt a card
deck (Deck): the deck being played
'''
player_card = deck.draw()
player.get_hand().append(player_card)
def collect(self, player):
'''
Collects the player's pot
Parameters:
player (Player): the player whose pot is being collected
'''
player.set_pot(0)
def pay_out(self, player):
'''
Pays the player an amount double the pot
Parameters:
player (Player): the player being paid
'''
player.set_amount_cash(player.get_amount_cash() + player.get_pot() * 2)
player.set_pot(0)