-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.py
57 lines (48 loc) · 1.38 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
class Player():
def __init__(self, name = None):
self.location = None
self.name = name
self.addr = None
self.hand = None
self.failed = False
def __str__(self):
if self.name == 'Col. Mustard':
return 'M'
elif self.name == 'Miss Scarlet':
return 'S'
elif self.name == 'Prof. Plum' :
return 'P'
elif self.name == 'Mrs. Peacock':
return 'C'
elif self.name == 'Mr. Green':
return 'G'
elif self.name =='Mrs. White':
return 'W'
def __repr__(self):
return str(self)
def setName(self, char):
'''
Sets the players name, generally by a successful connection to the host
'''
if char == 'M':
self.name = 'Col. Mustard'
elif char == 'S':
self.name = 'Miss Scarlet'
elif char == 'P':
self.name = 'Prof. Plum'
elif char == 'C':
self.name = 'Mrs. Peacock'
elif char == 'G':
self.name = 'Mr. Green'
elif char == 'W':
self.name = 'Mrs. White'
def setHand(self, cards):
self.hand = cards
def getHand(self):
return self.hand
def getName(self):
return self.name
def isFailed(self):
return self.failed
def setFailed(self):
self.failed = True