-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn_play.py
45 lines (33 loc) · 1020 Bytes
/
fn_play.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
from fn_map import show_the_map
def go(player):
print("\n")
dice_number = player.roll_the_dice()
player.move(dice_number)
def roll_the_dice(you, enemy):
if you.order == 0:
go(you)
show_the_map(you, enemy)
if you.idx < 20:
go(enemy)
show_the_map(you, enemy)
else:
go(enemy)
show_the_map(you, enemy)
if enemy.idx < 20:
go(you)
show_the_map(you, enemy)
def play(you, enemy):
while you.idx < 20 and enemy.idx < 20:
roll_the_dice(you, enemy)
if you.idx == 20 or enemy.idx == 20:
break
elif input("Will you roll the dice again? [Y/N]") == "N":
break
def show_the_winner(you, enemy):
winner = max(you.idx, enemy.idx, 20)
if winner == you.idx:
print("Bravo! You won!")
elif winner == enemy.idx:
print("The winner is your enemy.")
else:
print("Sorry to hear that playtime is over. \U0001F622")