I am trying to write the program such that player 1 rolls the dice twice, as does player 2. The summed outcome of the dice roll of player 1 is measured against that of player 2. If the summed outcome for player 1 is the same as player 2, then the dice rolling has to occur again in the same way it did initially. The output will read as to which player rolled the highest combined number.
import random
print('Player 1, pls roll the dice twice:')
MIN = 1
MAX = 6
def main():
dice = dice_outcome()
if r3 > r4:
print('Player 1 goes first')
elif r4 > r3:
print('Player 2 goes first')
else:
print('As both numbers are the same we need to randomly select again')
return dice_outcome()
def dice_outcome():
r1 = random.randint(MIN, MAX)
r2 = random.randint(MIN, MAX)
print(r1)
print(r2)
r3 = r1 + r2
print('The total of the two dice rolls is', r3)
print('')
return r3
print('Player 2, pls roll the dice twice: ')
r1 = random.randint(MIN, MAX)
r2 = random.randint(MIN, MAX)
print(r1)
print(r2)
r4 = r1 + r2
print('The total of the two dice rolls is', r4)
return r4
main()