-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.py
44 lines (35 loc) · 1.15 KB
/
game.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
44
import deck
import player
import card
class Game():
"""
docstring
"""
def __init__(self):
NUM_PLAYERS = 4
self.players = [player.Player(ix) for ix in range(0,NUM_PLAYERS)]
self.deck = deck.Deck()
self.trump = None
def deal(self):
NUM_CARDS = 5
for _ in range(0,NUM_CARDS):
for player in self.players:
player.hand.append(self.deck.deal())
def startGame(self):
card = self.deck.deal()
ROUNDS = 2
for _ in range(0,ROUNDS):
if self.trump: #trump has been declared so don't continue
break
for player in self.players: #loop through eah player to see if they select trump
if player.selectTrump(card):
self.trump = card.suit
break
if not self.trump:
#force dealer to select trump
pass
self.updateTrump()
def updateTrump(self):
for player in self.players: #update new card values for each player
for card in player.hand:
card.updateTrump(self.trump)