Thread Tools
Old August 26, 2001, 12:39   #1
SlowThinker
GameLeagueApolytoners Hall of Fame
King
 
SlowThinker's Avatar
 
Local Time: 14:50
Local Date: October 31, 2010
Join Date: Jan 2000
Location: homeless, Praha, Czech Republic
Posts: 2,603
Is the combat formula wrong?
IMHO the combat formula
P = SUMn(COMB(n-1,dh-1) * (p^dh) * (1-p)^(n-dh))
mentioned in http://apolyton.net/forums/showthrea...856#theformula
is wrong

Quote:
In layman's terms, P is the sum of the probabilities of the all 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).
The problem is that the event "the attacker winning ten straight combats" is also one of events "the attacker winning ten out of eleven".
In other words,
sets

{events; the attacker winning ten straight combats}
{events; the attacker winning ten out of eleven}
{events; the attacker winning ten out of twelve}
...

are not disjunctive and so they must not be added up.

Last edited by SlowThinker; August 26, 2001 at 12:57.
SlowThinker is offline  
Old August 26, 2001, 12:42   #2
SlowThinker
GameLeagueApolytoners Hall of Fame
King
 
SlowThinker's Avatar
 
Local Time: 14:50
Local Date: October 31, 2010
Join Date: Jan 2000
Location: homeless, Praha, Czech Republic
Posts: 2,603
My proposition of the correct formula:
Any line of dh+ah-1 combats (some combats are superfluous, because the result of the battle is known before the {dh+ah-1}th combat, but this does not matter) is an event.
(You may imagine an event as dh+ah-1 of bits. "1" means the attacker wins, "0" means the defender wins)
Events with at least dh wins of the attacker induce that the attacker wins the battle. Events with less than dh wins of the attacker induce that the attacker loses the battle.

P = SUMn(COMB(dh+ah-1,n) * (p^n) * (1-p)^(dh+ah-1-n))

Where "n" is summed from dh to dh+ah-1.

(n represents number of combat wins of the attacker
dh+ah-1-n represents number of combat wins of the defender
COMB(dh+ah-1,n) represents number of events where the attacker wins n combats)
SlowThinker is offline  
Old August 26, 2001, 13:57   #3
SlowThinker
GameLeagueApolytoners Hall of Fame
King
 
SlowThinker's Avatar
 
Local Time: 14:50
Local Date: October 31, 2010
Join Date: Jan 2000
Location: homeless, Praha, Czech Republic
Posts: 2,603
An additional note to the formula:
Quote:
Originally posted by Marquis de Sodaq
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.
I think that these numbers should be rounded up.
In other words, both 9-hitpoints unit and 10-hitpoints unit have 5 modified hitpoints against a 2FP unit.
SlowThinker is offline  
Old August 26, 2001, 21:11   #4
Marquis de Sodaq
King
 
Marquis de Sodaq's Avatar
 
Local Time: 06:50
Local Date: October 31, 2010
Join Date: Jul 2000
Location: ... no, a Marquis.
Posts: 2,179
I suspect this thread is supposed to get my attention.

The problem is that the event "the attacker winning ten straight combats" is also one of events "the attacker winning ten out of eleven".

Your logic is correct. Winning ten straight can be seen as one of the eleven possible subsets of winning ten of eleven. As for replacing the formula, it is not necessary. The chances of winning the first ten combats (be it out of 10, 12, or any other number) are actually different combinations. Winning the first ten is one outcome, but whether that would have been followed by 1, 2, or 9 losses makes them different. Although they have the same result, they are mathematically exclusive occurences.

Just in case I misunderstood you, I adopted your suggestion into my Excel calculator. The math ends up the with the same results. I believe, unless I have misread something, that you have discovered another way to come up with the same number. Let me know if you think what you have suggested changes the result, in which case I will redo my checks.
__________________
The first President of the first Apolyton Democracy Game (CivII, that is)

The gift of speech is given to many,
intelligence to few.
Marquis de Sodaq is offline  
Old August 26, 2001, 21:13   #5
Marquis de Sodaq
King
 
Marquis de Sodaq's Avatar
 
Local Time: 06:50
Local Date: October 31, 2010
Join Date: Jul 2000
Location: ... no, a Marquis.
Posts: 2,179
Quote:
Originally posted by SlowThinker
I think that these numbers should be rounded up.
In other words, both 9-hitpoints unit and 10-hitpoints unit have 5 modified hitpoints against a 2FP unit.
This part I have not yet tested. My calculations allow for the half (e.g. 4.5).
__________________
The first President of the first Apolyton Democracy Game (CivII, that is)

The gift of speech is given to many,
intelligence to few.
Marquis de Sodaq is offline  
Old August 27, 2001, 16:20   #6
SlowThinker
GameLeagueApolytoners Hall of Fame
King
 
SlowThinker's Avatar
 
Local Time: 14:50
Local Date: October 31, 2010
Join Date: Jan 2000
Location: homeless, Praha, Czech Republic
Posts: 2,603
Quote:
Originally posted by Marquis de Sodaq
This part I have not yet tested. My calculations allow for the half (e.g. 4.5).
I proceeded from the description of the combat system yesterday.
But I have tested it now. I think I am right. A 9FP 1HP unit is very weak against a 10FP 1HP unit, my results corresponds to a 5FP 1HP unit against a 10FP 1HP unit.
SlowThinker is offline  
Old August 27, 2001, 16:25   #7
SlowThinker
GameLeagueApolytoners Hall of Fame
King
 
SlowThinker's Avatar
 
Local Time: 14:50
Local Date: October 31, 2010
Join Date: Jan 2000
Location: homeless, Praha, Czech Republic
Posts: 2,603
Quote:
Originally posted by Marquis de Sodaq
IMHO, the combat formula is correct.




Yesterday I thought there is COMB(n,dh) in the original formula (it would correspond to "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").

Now I have understood that there is "-1" in the COMB expression, because the last combat must be won by the attacker, only first n-1 combats participate in combinations.
"n" represents the number of combats needed to destroy the defender, i.e. the defender is destroyed exactly in the n-th combat.

The outcome: the original combat formula is correct.

Last edited by SlowThinker; August 27, 2001 at 16:37.
SlowThinker is offline  
Old August 27, 2001, 21:49   #8
Marquis de Sodaq
King
 
Marquis de Sodaq's Avatar
 
Local Time: 06:50
Local Date: October 31, 2010
Join Date: Jul 2000
Location: ... no, a Marquis.
Posts: 2,179
Thanks again for testing what is becoming accepted as rote. The formula is a bit confusing to translate into coherent, language-based thought. That final -1 does indeed account for the necessary final win by the attacker.
__________________
The first President of the first Apolyton Democracy Game (CivII, that is)

The gift of speech is given to many,
intelligence to few.
Marquis de Sodaq is offline  
Old August 27, 2001, 22:40   #9
Boco
Scenario League / Civ2-Creation
King
 
Boco's Avatar
 
Local Time: 07:50
Local Date: October 31, 2010
Join Date: Jan 2001
Location: of underdogs
Posts: 1,774
Try BINOMDIST
This may already be known, but Excel has a worksheet function that appears to calculate P (overall probability) from p (probability per round) quite accurately in a single cell. In the English version it is:

"=1-BINOMDIST(dH_over_aF-1,aH_over_dF+dH_over_aF-1,Prob_per_Round,TRUE)" ,

where
dH_over_aF = def hit point / att firepower,
aH_over_dF = att hit point / def firepower,
Prob_per_Round = probability of victory per round (p),
TRUE forces the function to return the cumulative binomial distribution function.

Read the Excel help file on this function for more information. Using BINOMDIST also corrects a error in my flawed invocation of the Euclid/Buenos equation (E/B), which used Excel's COMBIN with ~60 rows of n (i.e. calculating P from p took ~180 cells!). The flaw is shown in the following example.

4a, 20hp, variable fp attacking 5a, 20hp, 1fp

Att fp E/B BINOMDIST dH_over_aF
1___7.6%___7.6%____20 (7.6% matches the number posted in the Eggman/Euclid/Buenos thread*)
2__74.3%__74.3%____10
3__70.6%__90.6%_____6.67
4__98.2%__98.2%_____5
5__99.3%__99.3%_____4
6__80.7%__99.8%_____3.33
7__57.4%_100%______2.86
8__67.6%_100%______2.50
9__76.7%_100%______2.22

Looks like I didn't truncate dH_over_aF to an integer properly. In any event, BINOMDIST in a single cell is far more elegant than a 180 cell calculation.

*http://apolyton.net/forums/Archives/...-1-000624.html
Boco is offline  
Old August 28, 2001, 09:57   #10
Marquis de Sodaq
King
 
Marquis de Sodaq's Avatar
 
Local Time: 06:50
Local Date: October 31, 2010
Join Date: Jul 2000
Location: ... no, a Marquis.
Posts: 2,179
Thanks, Boco. My Excel work also involved separate probabilities in rows, with a set of SUM cells for different ranges. It also took up 60+ rows. I'll look at that BINOMDIST function, it could save a heap of clutter in the calculation!
__________________
The first President of the first Apolyton Democracy Game (CivII, that is)

The gift of speech is given to many,
intelligence to few.
Marquis de Sodaq is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 08:50.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team