Mar-08-2020, 10:51 PM
Hello, I'm new to the forum! I'm having an issue with my double dice game code, I keep getting a syntax error. Help and any advice would be appreciated!
import random
def Dice():
player_1=0
Points1=0
player_2=0
Points2=0
player_12=0
player_22=0
Points12=0
Points22=0
totalpoints1=Points1 + Points12
totalpoints2=Points2 + Points22
rounds=1
while rounds !=4:
print("Round"+str(rounds))
player_1=dice_roll()
player_12=dice_roll()
player_2=dice_roll()
player_22=dice_roll()
print("Player one rolls a: " + str(player_1 + player_12))
print("Player two rolls a: "+ str(player_2+ player_22))
if player_1 +player_12 ==player_2+player_12:
print("It's a tie!")
elif player_1+ player_12>player_2 + player_22:
print("Player 1 wins!")
totalpoints1 = totalpoints2 + 1
else:
print("Player 2 Wins!")
totalpoints2 = totalpoints1 + 1
rounds=rounds+1
if Points1 + Points12 ==Points2 + Points22:
print("It's a tie!")
elif Points1 + Points12 >Points2 + Points22:
print("player 1 wins!")
else:
print("Player 2 Wins!")
def dice_roll():
diceRoll=random.randint(1,6)
return diceRoll
