You need to understand probability and statistics to comprehensively answer this question. As a point of reference, I covered the prerequesite material around the 3rd year of my undergraduate engineering degree, so the call for “Math Geeks” is well titled here. :-)
Some pertinent terms you’ll want to google/wiki/library: probability density function (PDF) cumulative density function (CDF), mean, standard deviation, and convolution.
@elzario:
Anyone have a working application that gives you “to hit” chance percentages when inputting types (and amount) of units?
I had thought of creating an app for it but why make something that already exists right?
Yes, but I haven’t publicized it. I wrote my own battle simulator in MATLAB which returns EXACT values, not Monte Carlo estimates. It calculates (and graphically displays) the total probability density function of a battle of an arbitrary number and type of dice on offense and defense. (i.e. PDF of all attackers surviving, all the way through to all defenders surviving, and everything in between). For a math geek, it’s very cool. 8-) The Monte Carlo simulators get reasonably close results, but the tail ends (say less than 2% probability) need a high run count to converge to the correct answer. Viewing the net PDF is significantly more useful than a simple “win/loss” percentage.
@elzario:
Its crazy to think that something so simple in practice becomes so convoluted in execution.
Oh, the poetic irony of that statement! One of the required pieces (also what the original poster was asking about) is to calculate the PDF of an arbitrary number of dice being rolled. Using the mathematical function convolution, this subroutine only takes 7 lines of code in MATLAB.
PDF = 1;
for i = 1:4
while(DiceCounts(i) > 0)
DiceCounts(i) = DiceCounts(i) - 1;
PDF = conv(PDF,[6-i i]/6);
end
end
Unfortunately, getting the exact answer using this method isn’t something that you do in your head, especially for a large number of dice rolls. On the plus side, it only requires one convolution per dice roll to get the exact answer, unlike Monte Carlo simulators that may require 1,000-10,000 runs to converge to a statistically reliable result.
DiceCounts is a 1x4 vector, where each element contains the number of dice being rolled at each number. I.e. DiceCounts(i) is the number of units rolling at i. The output PDF is a 1x(n+1) vector containing the probability of getting the exact number of hits for each possible outcome, where n is the total number of dice rolled, and PDF(x) is the probability of getting exactly x-1 hits. Integrating the PDF results in the CDF, which can be used to calculate the probability of getting a minimum (or maximum) number of hits.
@Zhukov44:
How would I determine the % likelihood of getting 1 hit with a punch of 7?
So, to answer your question – it entirely depends on what units are attacking. 7 infantry attacking will yield a different PDF than a tank and a bomber, even though both have a total attack value (punch) of 7.
Lets use Cow’s example of 6 infantry attacking, and also 2 fighters attacking. Both clearly have a mean of 1.
6 infantry: mean = 1, std = 0.1704.
6 Infantry PDF (in %): 33.4898 40.1878 20.0939 5.3584 0.8038 0.0643 0.0021
6 infantry min# of hits (in %): 100.000 66.5102 26.3224 6.2286 0.8702 0.0664 0.0021
2 fighters: mean = 1, std = 0.1443.
2 fighters PDF (in %): 25 50 25
2 fighters min# of hits (in %): 100 75 25
The 6 infantry do have a slightly higher standard deviation than the 2 fighters, and from the above you can see that 6 infantry have a 66.5% chance to get at least one hit, and the 2 fighters have a 75% chance to get at least 1 hit.
However, it does not always follow that smaller numbers of dice rolls always result in lower standard deviation given the same attack power. For example, consider 8 infantry attacking, compared to 2 bombers attacking.
8 infantry: mean = 1.33, std = 0.1418.
8 Infantry PDF (in %): 23.2568 37.2109 26.0476 10.4190 2.6048 0.4168 0.0417 0.0024 0.0001
8 infantry min# of hits (in %): 100.0000 76.7432 39.5323 13.4847 3.0656 0.4609 0.0441 0.0024 0.0001
2 bombers: mean = 1.33, std = 0.1925.
2 bombers PDF (in %): 11.1111 44.4444 44.4444
2 bombers min# of hits (in %): 100.0000 88.8889 44.4444
2 bombers attacking have a higher standard deviation than 2 fighters, but you are still more likely to get at least 1 or 2 hits with 2 bombers than you are with 8 infantry. So, standard deviation is only one measure of variability, and not always the best measure.
Another example previously given: 1 fighter, 1 tank, 1 infantry (1@1, 2@3):
1@1 + 2@3: mean = 1.1667, std = 0.1735
1@1 + 2@3 PDF (%): 20.8333 45.8333 29.1667 4.1667
1@1 + 2@3 min # hits (%): 100.000 79.1667 33.3333 4.1667
In general, as the number of dice rolls increases, the net distribution ends up looking like a Gaussian distribution regardless of what the PDFs look like for the individual dice rolls. (Central Limit Theorem).