I am trying to write an odds calculator for risk that calculates the percentage chance of winning a combat between a number of given Attackers and given Defenders.

The calculator will use basic risk rules, that is, the attacker roles dice equal to the number of attackers but no more than 3. The defender does the same but is limited to 2 dice. The resulting roles are sorted and then combat is determined by comparing the two top dice and removing them from the stack. The side with the lower die roll loses one troop. This process continues until one side wins.

What I want to know is if their is an equation that can be used to solve this without creating the normal statistics tree. Creating that tree, while it works, becomes unmanageable after either side goes above 10 or more troops.

My current solution is to simulate 100,000 combats and then take the number of times the Attacker wins/100,000 to get the percent chance of winning the combat. This solution also works, however, since it is based on random chance itself the results can be off by significant amounts. It also requires simulating a lot of combat.

Is there some function I could use to calculate this result without having to use one of the previously mentioned solutions?

up vote 3 down vote accepted

Let $F(m,n)$ be the probability of the attacker winning when the attacker starts with $m$ armies and the defender starts with $n$. Then for $m \ge 3$ and $n \ge 2$, $F(m,n) = a F(m-2,n) + b F(m-1,n-1) + c F(m,n-2)$ where $a$, $b$ and $c$ are the probabilities of the attacker losing 2, both losing 1, and defender losing 2 on a roll (you can compute these easily). For $m < 3$ or $n < 2$, the equation changes somewhat because only one army is lost on a roll. The boundary conditions are $F(m,0) = 1$ for $m \ge 2$, $F(1,n) = 0$ for $n \ge 1$. It's then straightforward to determine $F(m,n)$ in a double loop.

  • I agree! I wrote a Risk simulation a few years ago, and I believe this was the method I used to calculate winning probabilities in battles. – smackcrane Nov 29 '12 at 3:45
  • (0.2926 * F(A - 2, D)) + (0.3358 * F(A - 1, D - 1)) + (0.3717 * F(A, D - 2)) I am using this equation for F(m,n) where A and D are the numbers of Defenders and Attackers. However, this is resulting in probabilities greater than 100% for large values of A. I pulled the values of a, b and c from Wikipedia. Any idea what I am doing wrong @robert-israel ? – Runewake2 Nov 29 '12 at 20:32

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.