I have made a program that does the rolling for you for the board game "Risk" I even made it tell only the attackers top two rolled and it says the attacks and defenders rolled in order of highest to lowest.
But I need it to say who has to give up which pieces.
The rules in risk, in case the person who can help me doesn't know, is that you compare your highest role to their highest role and your second with their second. If both your roles are higher, they lose two guys, if one of yours is higher and one of theirs is higher you each lose one, ties are given to the defender.
#Risk dice simulator#
import random
from time import time
attack = True
defense = True
raw_input("Risk Rolling Simulator")
aR1 = random.randint(1,6)
aR2 = random.randint(1,6)
aR3 = random.randint(1,6)
dR1 = random.randint(1,6)
dR2 = random.randint(1,6)
print "Rolled:\n"
print "Attack:"
print aR1, aR2, aR3
print "\nDefense:"
print dR1, dR2
if dR1 > dR2:
defense = dR1, dR2
elif dR1 < dR2:
defense = dR2, dR1
elif dR1 == dR2:
defense = dR1, dR2
if aR1 > aR3 and aR2 > aR3 and aR1 > aR2:
attack = aR1, aR2
elif aR1 > aR3 and aR2 > aR3 and aR2 > aR1:
attack = aR2, aR1
elif aR1 > aR2 and aR3 > aR2 and aR1 > aR3:
attack = aR1, aR3
elif aR1 > aR2 and aR3 > aR2 and aR3 > aR1:
attack = aR3, aR1
elif aR2 > aR1 and aR3 > aR1 and aR2 > aR3:
attack = aR2, aR3
elif aR2 > aR1 and aR3 > aR1 and aR3 > aR2:
attack = aR3, aR2
elif aR1 > aR3 and aR2 == aR3:
attack = aR1, aR2
elif aR2 > aR3 and aR1 == aR3:
attack = aR2, aR1
elif aR3 > aR1 and aR2 == aR1:
attack = aR3, aR2
elif aR1 < aR3 and aR2 == aR3:
attack = aR3, aR2
elif aR2 < aR3 and aR1 == aR3:
attack = aR3, aR1
elif aR3 < aR1 and aR2 == aR1:
attack = aR1, aR2
elif aR1 == aR2 and aR2 == aR3:
attack = aR1, aR2
print "\nResults are:"
print attack, "vs.", defense
raw_input("")
execfile("Risk.py")