forked from csfeeser/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheatdice.py
More file actions
36 lines (29 loc) · 756 Bytes
/
cheatdice.py
File metadata and controls
36 lines (29 loc) · 756 Bytes
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
from random import randint
class Player:
def __init__(self):
self.dice = []
def roll(self):
self.dice = [] # clears current dice
for i in range(3):
self.dice.append(randint(1,6))
def get_dice(self):
return self.dice
class Cheat_Mulligan(Player):
def cheat(self):
while sum(self.dice) <= 9:
self.dice = []
for i in range(3):
self.dice.append(randint(1,6))
class Cheat_Extra_Die(Player):
def cheat(self):
self.dice.append(randint(1,6))
class Cheat_Swapper(Player):
def cheat(self):
self.dice[-1] = 6
class Cheat_Loaded_Dice(Player):
def cheat(self):
i = 0
while i < len(self.dice):
if self.dice[i] < 6:
self.dice[i] += 1
i += 1