-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.py
72 lines (52 loc) · 1.97 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
61
62
63
64
65
66
67
68
69
70
71
72
from Card import Card
from GameState import GameState
class Player(object):
ORDER_UP = True
PASS = False
def __init__(self, player_num: int, team_id: int, player_name: str):
self.team_id = team_id
self.hand = list()
self.name = player_name
self.player_num = player_num
self.is_dealer = False
self.going_alone = False
self.sitting_out = False
self.hand_score = 0
def make_move(self, game_state: GameState):
raise Exception("Cannot have a player without a personality.")
def receive_card(self, card_list: list):
"""
Receive a list of cards.
Must be a list
:param card_list: a list of N cards to put into the hand
:return: Nothing
"""
self.hand += card_list
def make_bid_rnd_1(self, top_card: Card) -> int:
raise Exception("Players without personalities cannot make bids")
def make_bid_rnd_2(self, top_card: Card) -> int:
raise Exception("Players without personalities cannot pick trumps.")
def discard(self, game_state: GameState):
raise Exception("Players without personalities cannot decide what to discard.")
def is_loaner(self, game_state: GameState) -> bool:
raise Exception("Players without personalities are always loaners and that makes for a bad partner!")
def set_dealer(self):
self.is_dealer = True
def set_not_dealer(self):
self.is_dealer = False
def get_is_dealer(self) -> bool:
return self.is_dealer
def clear_hand(self):
self.hand = list()
def sit_out(self):
self.sitting_out = True
self.going_alone = False
def is_sitting_out(self):
return self.sitting_out
def reset(self):
self.clear_hand()
self.sitting_out = False
self.going_alone = False
self.is_dealer = False
def __repr__(self):
return "Name: {} Team {} Hand: {}".format(self.name, self.team_id, self.hand)