a remind
Originally posted by sodak
ah = Attacker's modified hit points
dh = Defender's modified hit points
p = probability for attacker to win combat round
P = probability for attacker to win battle
Note: Modified hit points: An opponent's total hit points are divided by the unit's firepower. Thus an attacker with 2fp halves the defender's total hit points.
So ah represents the number of combat rounds that the attacker must lose so that it is definitely destroyed, similarly dh.
Sorry, I see in my last post I swapped terms battle and combat! From now I will use Sodak's terms.
Comb is the 'combinatorial number':
Comb(n,k)=n! / k!*(n-k!)
(! is the factorial)
Comb(n,k) is equal to number of k-sized subsets of a set of size n
^ is the exponent
It is clear that
P=SUMn (probability that attacker wins dh combat rounds and loses n-dh combat rounds - so there is total n rounds)
Where "n" is summed from dh to dh+ah-1 (then attacker loses from 0 to ah-1 rounds: it cannot lose more because he would be killed)
p^dh is equal to a probablity that attacker will win dh times in a row
(1-p)^(n-dh) is equal to a probablity that attacker will lose n-dh times in a row
(p^dh) * (1-p)^(n-dh) is equal to a probablity that attacker will win dh times and lose n-dh times
Attacker always wins the last round, but the n-1 preceeding results (win-loss) may be mixed up in COMB(n-1,dh-1) ways
An example of mixing Wins and Loses:
n=6, dh=4 (therefore there must be 4 Wins so that defender is destroyed), n-dh=2 (it is the number of Loses)
W W W L L W (last round is always Win)
W W L W L W
W L W W L W
L W W W L W
W W L L W W
W L W L W W
L W W L W W
...
L L W W W W
total is COMB(5,2)=10
That's all.
BTW Sodak explains it this way:
Originally posted by Sodak
In layman's terms, P is the sum of the probabilities of all the possible outcomes of the attacker winning. For example, the odds of the attacker winning ten straight combats, plus that of winning ten out of eleven, plus that of winning ten out of twelve, and so on, added together to produce a grand total. The maximum number of rounds is the attacker's and defender's total hit points minus one. Basically, until the winner is left with a single hit point after destroying the loser. The defender's chance is (1 - winner's probability).