If you are unfamiliar with Risk, see this for battle situations:
I’m trying to calculate the exact probabilities that:
If A throws 3 dice and D throws 2, what’s the chance A will win both soldiers, get even, or lose two?
How might I come up with an algorithm that you can enter the number of attackers and defenders and give you the probability that the attacker will destroy the other army? Is that even possible?
According to a quick little program I just whipped up, out of 7776 possible combinations of dice rolls, 3667 of them lead to the attacker winning and 4109 of them lead to the defender winning. Thus, the winning percentage is a little over 47%.
If you want to know for army numbers, it gets a bit more complicated.
Doh, I forgot about the 2nd die. Okay, modified program now gives:
For 3 die attacker, 2 die defender, 7776 different combinations,
2890 attacker wins both
2275 each person loses an army
2611 defender wins both.
So the attacker is slightly ahead.
According to a quick little program I just whipped up, out of 7776 possible combinations of dice rolls, 3667 of them lead to the attacker winning and 4109 of them lead to the defender winning. Thus, the winning percentage is a little over 47%.
If you want to know for army numbers, it gets a bit more complicated.
37% : 29% : 34%
Therefore, he’ll lose two armies 37% of the time, you’ll lose two 34% of the time, and you’ll both lose one 29% of the time.
Evening that out over one roll gets us:
He’ll lose 1.3 armies to your .97 armies per turn.
Let’s say he has 13 armies. According to the probabilities, it’ll take you 10 turns to eradicate them, and you’ll lose 9.7 armies in the process. So if you have more than that, you’ll be ok, according to the probability.
Except not, because the probabilites change when the number of dice change.
Believe it or not, this has been done. Quite a bit. If you search for “risk probabilities army” in, say, Google, you’ll get a lot of hits. Here’s the one I learned from:
http://www.maths.nott.ac.uk/personal/odl/riskfaq.html#Prob
As for the formula you ask for, the probability of victory given number of attackers and number of defenders, there’s no simple formula. But it is possible to calculate via computer:
http://www.dandrake.com/risk.html
The first page I linked to did have a formula for the number of armies that the attacker can expect to lose if attacking N defending armies. This is roughly equal to the size of the attacking army which has a 50% chance of success. (It does get a little messed up because the attacker is at a disadvantage when he gets down to 3 or 2 armies.)
0.8534144 N - 0.2213413 (1 - (-0.525359)[sup]N[/sup])
For instance, for N = 24 defending armies, the formula comes out to 20.26, so an attacking army would expect to lose about 20 armies. Since 0.8534 is around 5/6, and the second term is small, in general the attacker expects to lose about 5/6 as many armies as the defender has.
Bah! All this randomness just goes to show that Diplomacy is a far superior game 