Announcement

Collapse
No announcement yet.

Is the combat formula wrong?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

    In layman's terms, P is the sum of the probabilities of the all possible outcomes of the attacker winning; <b>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</b>. 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 "<I>the attacker winning ten straight combats</I>" is also one of events "<I>the attacker winning ten out of eleven</I>".
    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.
    Civ2 "Great Library Index": direct download, Apolyton attachment

  • #2
    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)
    Civ2 "Great Library Index": direct download, Apolyton attachment

    Comment


    • #3
      An additional note to the formula:
      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.
      Civ2 "Great Library Index": direct download, Apolyton attachment

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment


          • #6
            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.
            Civ2 "Great Library Index": direct download, Apolyton attachment

            Comment


            • #7
              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.
              Civ2 "Great Library Index": direct download, Apolyton attachment

              Comment


              • #8
                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.

                Comment


                • #9
                  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
                  El Aurens v2 Beta!

                  Comment


                  • #10
                    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.

                    Comment

                    Working...
                    X