-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.py
59 lines (51 loc) · 1.68 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
class Player:
def __init__(self,name):
self.name = name
self.round = 0
self.game = 1
self.roll = 1
self.ones = ['-','-','-']
self.twos = ['-','-','-']
self.threes = ['-','-','-']
self.fours = ['-','-','-']
self.fives = ['-','-','-']
self.sixes = ['-','-','-']
self.total1 = ['-','-','-']
self.double = ['-','-','-']
self.triple = ['-','-','-']
self.doubles = ['-','-','-']
self.full = ['-','-','-']
self.straight = ['-','-','-']
self.straight2 = ['-','-','-']
self.quatro = ['-','-','-']
self.general = ['-','-','-']
self.chance = ['-','-','-']
self.total2 = ['-','-','-']
self.score = '-'
def total1f(self):
try:
total = self.ones[self.round] + self.twos[self.round] + self.threes[self.round] + self.fours[self.round] + self.fives[self.round] + self.sixes[self.round]
return total - 50 if total < 0 else total
except:
return '-'
def total2f(self):
try:
return self.total1[self.round] + \
self.double[self.round] + \
self.triple[self.round] + \
self.doubles[self.round] + \
self.full[self.round] + \
self.straight[self.round] + \
self.straight2[self.round] + \
self.quatro[self.round] + \
self.general[self.round] + \
self.chance[self.round]
except:
return '-'
def scoreFunc(self):
try:
return sum(self.total2)
except:
return '-'
def change_round(self):
return self.round + 1 if type(self.total2[self.round]) is int else self.round