In the PC game Civilization III, combat units can engage in, well, combat. We will define a battle as a set of rounds where the loser has no more hit points remaining. Each round forces someone to lose one hit point.

In CivIII, ignoring unnecessary complications, the odds of winning a round are based on the units in combat. Each unit has attack and defend values, as well as already mentioned hit points. The odds of the attacker winning any particular *round* of battle is “own attack points / (own attack points + other defend points)”. To use a real example, suppose a Cavalry (attack 6 defend 3) is fighting a Musketman (attack something defend 4). The cavalry intitiates battle, making it the attacker, and it thus has a probability of winning any round of battle as 6/(6+4) = 60%. Simple enough.

But remember I said that the rounds go on until someone is out of hit points. Intuitively, if the defender has, say, five hit points, and the attacker has only 3, then the odds of the defender winning the *battle* should be better than the odds of him winning any one round, because he can see more rounds than the attacker can.

So what I did was pick up a prob&stat book and found this formula:

P® = [sub]n[/sub]C[sub]r[/sub] * p[sup]r[/sup] * q[sup]n-r[/sup]

where

P® is the probability of getting exactly r wins in n trials, where p is the probability of a win and q is the probability of a loss (1-p) in each individual trial.

When I did the math, I got the result of about 25% for the attacker. In other words, even though the attacker would win 60% of the rounds in general, his lack of hit points means he will only end up winning battles like this 25% of the time.

If I messed up the math for 25%, that’s one thing, I’m going to go home later and work things out in excel where these calculations are not as error-prone as using a calculator and writing down numbers. But the question is, is this the right formula? And can I only use it from the perspective of a unit with the least amount of hit points? It almost seems that this is not the right formula because in some scenarios we never get to see all 7 trials (always attack’s hit points + defender’s hit points - 1) because the attacker wins five in a row or the defender wins three in a row, etc. But then I think, like I said, pick the unit with the most hit points and calculate from his perspective. So you can see I’m just a little confused on the matter.

Hopefully this is actually clear.

[sub]Yes, I know about the existence of a CivIII calculator for this. The point is knowing the math. It is an interesting problem.[/sub]