-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.py
60 lines (46 loc) · 1.34 KB
/
player.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import card
class Player():
"""
docstring
"""
def __init__(self, pos):
self.pos = pos
self.hand = []
def __str__(self):
print('Player ' + str(self.pos) + ':')
for card in self.hand:
print(card)
return "End of Hand"
def selectTrump(self, trumpSuit):
selectTrump = False
numTrump = 0
numOffAce = 0
for card in self.hand:
if card.isOffAce(trumpSuit):
numOffAce += 1
elif card.isTrump(trumpSuit):
numTrump += 1
#need at least 3 trumps/off aces to pick trump
if numTrump+numOffAce >= 3:
selectTrump = True
return selectTrump
def screwDealer(self):
#pick best auit from your hand
trumpSuit = 'C'
counter = 0
for card in self.hand:
if
return trumpSuit
def rankHand(self, trumpSuit):
handRank = 0
cardRank = 0
trumpRank = 10
bowerRank = 4
for card in self.hand:
cardRank = card.value
if card.isTrump(trumpSuit):
cardRank += trumpRank
if card.isBower(trumpSuit):
cardRank += bowerRank
handRank += cardRank
return handRank