Hmm, I saw a topic about someone wanting this to be done and I was thinking about creating one, but it seems that I am already beaten.
My method for calculating the possibilities was pretty similar. To simplify, let’s start with a battle of 4 inf attacking 2 inf.
We need to find out the probability for the attacker hitting between 0 and 4. This is quite easy. We take the fourth row of Pascal’s Triangle.
1 4 6 4 1
We will use this as a modifier value. This would be the chance that you would hit at a die roll of 3.
Because inf hit at 1 value and miss at 5 values. We will use the following row to multiply our modifiers by…
5^4 5^3 5^2 5^1 5^0
After the multiplication this yeilds…
625 500 150 20 1
These numbers represent the chance out of 6^4 (1296).
So the attacker will have the following outcomes…
0 hits = 625/1296 = 48.225%
1 hits = 500/1296 = 38.58%
2 hits = 150/1296 = 11.57%
3 hits = 020/1296 = 01.54%
4 hits = 001/1296 = 00.077%
If we do the same thing for the defender we get
2 hits = 4/36 = 11%
1 hits = 16/36 = 44%
0 hits = 16/36 = 44%
Now we have to combine all these possibilities to arrive at the chances for the new amount of troops left.
For this specific case we can combine the 2,3, and 4 hits for the attacker b/c they all arive at the same point.
We end up with the following probabilities after the first round of attacks.
2inf - 0inf = 1.466%
3inf - 0inf = 5.864%
4inf - 0inf = 5.864%
2inf - 1inf = 4.287%
3inf - 1inf = 17.147%
4inf - 1inf = 17.147%
2inf - 2inf = 5.358%
3inf - 2inf = 21.433%
4inf - 2inf = 21.433%
Now we have the probabilities for the remaining units after the battle. We have to analyze each of these possibilities to see what results from the new battle.
Of course we complicate this with the addition of multiple types of units, but you get the general picture of my proposed idea. It looks like I can stop trying to implement it b/c your version works fine.
Great job, thx for all the hard work.