-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdice roller.py
More file actions
39 lines (32 loc) · 995 Bytes
/
Copy pathdice roller.py
File metadata and controls
39 lines (32 loc) · 995 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
37
38
39
import random
def main():
player1 = 0
player1wins = 0
player2 = 0
player2wins = 0
rounds = 1
while rounds != 10:
print("Round " + str(rounds))
player1 = dice_roll()
player2 = dice_roll()
print("Player 1 Roll: " + str(player1))
print("Player 2 Roll: " + str(player2))
if player1 == player2:
print("Draw!\n")
elif player1 > player2:
player1wins = player1wins + 1
print("Player 1 wins!\n")
else:
player2wins = player2wins + 1
print("Player 2 wins!\n")
rounds = rounds + 1
if player1wins == player2wins:
print("Draw!")
elif player1wins > player2wins:
print("Player 1 Wins - Rounds Won: " + str(player1wins))
else:
print("Player 2 Wins - Rounds Won: " + str(player2wins))
def dice_roll():
diceRoll = random.randint(1, 6)
return diceRoll
main()