Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions solutions/dicegame/runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .die import Die
from .die import Die, roll
from .utils import i_just_throw_an_exception

class GameRunner:
Expand All @@ -21,12 +21,14 @@ def answer(self):

@classmethod
def run(cls):
count = 0
consecutive_wins = 0
runner = cls()
while True:

print("Round {}\n".format(runner.round))

roll(runner.dice)

for die in runner.dice:
print(die.show())

Expand All @@ -36,18 +38,17 @@ def run(cls):
if guess == runner.answer:
print("Congrats, you can add like a 5 year old...")
runner.wins += 1
count += 1
runner.consecutive_wins += 1
consecutive_wins += 1
else:
print("Sorry that's wrong")
print("The answer is: {}".format(runner.answer))
print("Like seriously, how could you mess that up")
runner.loses += 1
count = 0
consecutive_wins = 0
print("Wins: {} Loses {}".format(runner.wins, runner.loses))
runner.round += 1

if count == 6:
if consecutive_wins == 6:
print("You won... Congrats...")
print("The fact it took you so long is pretty sad")
break
Expand Down