-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.py
36 lines (29 loc) · 938 Bytes
/
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
class Player:
def __init__(self, name, round_score=0, total_score=0):
self._name = name
self._round_score = round_score
self._total_score = total_score
@property
def name(self):
return self._name
@property
def total_score(self):
return self._total_score
@property
def round_score(self):
return self._round_score
def add_total_score(self, val):
self._total_score += val
def add_round_score(self, val):
self._round_score += val
# Reset the value of specified score to 0
# Valid parameters for which are:
# "ROUND", "TOTAL", "BOTH"
def reset_score(self, which="ROUND", ):
if which is "ROUND":
self._round_score = 0
elif which is "TOTAL":
self._total_score = 0
else:
self._round_score = 0
self._total_score = 0