Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
have you made a graph of the basic risk map yet? If you are willing to share, I'd love to see it. – tacos_tacos_tacos Nov 29 '12 at 3:12
nevermind, someone else on the web has: – tacos_tacos_tacos Nov 29 '12 at 3:14
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.

share|cite|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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