-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollinggame.py
More file actions
39 lines (32 loc) · 937 Bytes
/
Copy pathrollinggame.py
File metadata and controls
39 lines (32 loc) · 937 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
player2 = 0
player1wins = 0
player2wins = 0
rounds = 1
while rounds !=4:
print("Round" + str(rounds))
player1 = dice_roll()
player2 = dice_roll()
print("Player1 Roll:" + str(player1))
print("Player2 Roll:" + str(player2))
if player1 == player2:
print("DRAW\n")
elif player1 > player2:
player1wins = player1wins + 1
print("Player1 WINS!\n")
else:
player2wins = player2wins + 1
print("Player2 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()