Professional Documents
Culture Documents
Dicegame JackM
Dicegame JackM
x = 0
P1points = 0
P2points = 0
P1TB = 0
P2TB = 0
Wpoints = 0
P2 = input(("Enter the name of player 1: "))
P1 = input(("Enter the name of player 2: "))
def roll():
points = 0
R1 = random.randint(1,6)
R2 = random.randint(1,6)
Total = R1 + R2
if Total % 2 == 0:
points = points + 10
else:
points = points - 5
if R1 == R2:
R3 = random.randint(1,6)
points = points +R3
return(points)
for x in range(1,5):
P1points += roll()
print('After this round',P2, 'you now have: ',P1points,' Points')
P2points += roll()
print('After this round',P1, 'you now have: ',P2points,' Points')
if P1points == P2points:
while P1TB == P2TB:
P1TB = random.randint(1,6)
P2TB = random.randint(1,6)
if P1points>P2points:
Wpoints = P1points
Wplayer = P2
winner = (Wpoints, P2)
print(Wplayer,'won with ',Wpoints,' Points')
elif P2points>P1points:
Wpoints = P2points
winner = (Wpoints, P1)
Wplayer = P1
print('Well done,', Wplayer,' won with ',Wpoints,' Points')
elif P1points == P2points:
print('Damm that means its a draw')