TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    Battle Calc Question

    Scheduled Pinned Locked Moved Player Help
    38 Posts 9 Posters 14.2k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      beelee
      last edited by

      While being fairly good with numbers, advanced math, not so much. This guy has a chart:

      link text that leads me to believe that the odds of rolling a 1 or 2 with 2, 6 sided dice is 66.7%.

      So I tried it with 2 subs who hit at 1 or 2 against a cruiser that hit's at 1, 2 or 3 ( which probably isn't super relevant ) and I get 58% basically instead of 67% when set to one rd of battle.

      0_1520307255051_Screenshot from 2018-03-05 21-25-21.png

      So is this Guy's number's wrong or is triplea or both ? He seemed to make a pretty logical explanation and since I'm only testing 1 rd of combat with the sub getting an instant kill if it hits, seems as if 67% should be correct ?

      Would appreciate any mathematicians who care to take the time to explain this to me : )

      Thanks

      redrumR W prastleP 3 Replies Last reply Reply Quote 1
      • redrumR Offline
        redrum Admin @beelee
        last edited by redrum

        @beelee So one thing to remember is the battle calc is approximate and just averages based on the run count (increasing run count should get closer to the true value). That said the chance with dice that 2 subs get at least 1 hit in the first round is ~55.56%. The easiest way to think about it is what is the chance of both subs missing? The answer is (4/6) * (4/6) = 4/9 = 44.44% so the chance that 1 or both hit is 100% - 44.44% = 55.56%. So the battle calc is pretty close given you only have it set to 400 run count.

        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

        B 1 Reply Last reply Reply Quote 3
        • B Offline
          beelee @redrum
          last edited by

          @redrum Hey cool Thanks redrum. I guess that guys stuff is off or I misinterpreted it.

          General_ZodG 1 Reply Last reply Reply Quote 0
          • General_ZodG Offline
            General_Zod Moderators @beelee
            last edited by General_Zod

            @beelee With run count set to 1. You will see that the results are all over the place as well. Thus this result is extremely misleading. For dice any ways.

            1 Reply Last reply Reply Quote 1
            • W Offline
              wc_sumpton @beelee
              last edited by

              @beelee LOL - I just caught this. Thank you 'Kent' you gave me a good laugh!

              explanation: 'Kent' is the friend of the article writer wanted a 6, with 1 dice = 1/6 thus: with 2 dice =2/6 (incorrect) but, 1 or 2 = 2/6 with 2 dice does not = 4/6 (ie 66.7%).

              But I had to read you post a couple of times to catch the error. Thank You!!

              Cheers... (LOL)

              1 Reply Last reply Reply Quote 0
              • RoiEXR Offline
                RoiEX Admin
                last edited by RoiEX

                I had to think about this for like half an hour because I wanted to know why @beelee's assumption was wrong and @redrum is correct and I believe I figured it out now:
                The only mistake is a false assumption that adding the 2 probabilities is the same as throwing dice multiple times. According to that logic throwing at least a 1 or 2 a single time with 4 dice is 1/3 + 1/3 + 1/3 + 1/3 = 4/3 which is of course wrong for obvious reasons.
                What you would need to do instead (if you don't want to calculate the probability of the event not happening as suggested by @redrum) is to add the probabilities of throwing 1/2, then 3-6 plus throwing 1/2, then 1/2 plus throwing 3-6, then 1/2
                Which would be 2 * (2/3 * 1/3) + 1/3 * 1/3 = 4/9 + 1/9 = 5/9 as @redrum Already pointed out.

                But yes, the name OddsCalculator is misleading, because it doesn't really calculate anything it just simulates battles and shows average results of those simulations.
                Now that I'm thinking about it: Calculating odds with actual stochastics would probably be a huge performance improvement for the hard AI, I'll look into that soon /cc @ssoloff
                As a side note (because I remember having this in school) there's a so called significance test that's all about theoretical probabilities vs real world applications.

                C 1 Reply Last reply Reply Quote 0
                • C Offline
                  Cernel Moderators @RoiEX
                  last edited by

                  @roiex said in Battle Calc Question:

                  I had to think about this for like half an hour because I wanted to know why @beelee's assumption was wrong and @redrum is correct and I believe I figured it out now:
                  The only mistake is a false assumption that adding the 2 probabilities is the same as throwing dice multiple times. According to that logic throwing at least a 1 or 2 a single time with 4 dice is 1/3 + 1/3 + 1/3 + 1/3 = 4/3 which is of course wrong for obvious reasons.
                  What you would need to do instead (if you don't want to calculate the probability of the event not happening as suggested by @redrum) is to add the probabilities of throwing 1/2, then 3-6 plus throwing 1/2, then 1/2 plus throwing 3-6, then 1/2
                  Which would be 2 * (2/3 * 1/3) + 1/3 * 1/3 = 4/9 + 1/9 = 5/9 as @redrum Already pointed out.

                  But yes, the name OddsCalculator is misleading, because it doesn't really calculate anything it just simulates battles and shows average results of those simulations.

                  I've said a bunch of times that the name should be changed to BattleSimulator.

                  1 Reply Last reply Reply Quote 1
                  • RoiEXR Offline
                    RoiEX Admin
                    last edited by

                    @Cernel Ooor it should actually calculate the odds, which is what I'm proposing.
                    Because in theory we should expect the dice to not be rigged, and therefore the result should not differ ^^

                    redrumR C 2 Replies Last reply Reply Quote 0
                    • redrumR Offline
                      redrum Admin @RoiEX
                      last edited by redrum

                      @roiex I'm pretty sure the reason we simulate rather than trying to calculate the true odds is complexity and that you'd have to keep that code in sync with the actual battle rolling code if you did create it. Calculating the true odds for 1 round combat isn't too bad but once you expand this out to unlimited rounds of combat with units that have AA attacks, support attachments, etc, it becomes pretty crazy. In the end, I believe you'd have to create a giant tree with each round of combat being a level in that tree and the number of branches to the next level would be equal to the number of different casualty combinations for both sides.

                      The example above would be something like this:
                      round 0: (A 2 subs, D 1 cruiser)
                      round 1: [(A 2 subs, D 1 cruiser) - 22%], [(A 1 subs, D 1 cruiser) - 22%], [(A 2 subs, D 0 cruiser) - 56% - end]
                      round 2: [(A 2 subs, D 1 cruiser) - 5%, (A 1 subs, D 1 cruiser) - 5%, (A 2 subs, D 0 cruiser) - 12%], [(A 1 subs, D 0 cruiser) - 7%, (A 1 subs, D 1 cruiser) - 7%, (A 0 subs, D 1 cruiser) - 7%]
                      ...

                      You'd have to probably expand the tree out until the probabilities get small enough to not really matter. Then you'd have to calculate all of the metrics off the probability tree you generated.

                      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                      RoiEXR 1 Reply Last reply Reply Quote 0
                      • C Offline
                        Cernel Moderators @RoiEX
                        last edited by

                        @roiex This would be cool, but I would surely suggest you to keep the current BattleCalculator, rename it to BattleSimulator, and add another utility, called BattleCalculator, to do actual calculations. The reason being that with all the stuff going on I don't think it is really feasible to have the math to cover all cases (and there are a few cases not even fully covered by the current simulations, like the "isMarine" property) and that would be a terrible burden imposed to any further changes or additions, as, in any moment you do anything influencing calculation, you would need to update the actual BattleCalculator too (and I can see this really getting in the way of adding features).
                        Just based on how much having a BattleCalculator would disincentive adding any kind of additional combat features (think about AA guns specials), I would suggest to forget about it, even tho it is cool, in theory.
                        But it would be good if it would be just a subset, supporting only the most common feature, and retaining an alternative BattleSimulator (the current BattleCalculator) for more complex maps. Then, the BattleSimulator could even be absent default, and let the mapmakers of more advanced maps have it, if they think so. Say, you make a reduced BattleCalculator for Classic, Revised and v3, covering all those things that are pretty much set in stone, but TWW etc. keep using the simulations.

                        1 Reply Last reply Reply Quote 0
                        • ssoloffS Offline
                          ssoloff Admin
                          last edited by

                          I guess that guys stuff is off or I misinterpreted it.

                          @beelee I don't think Ed Collins is wrong. As you said, it may just be a misinterpretation of his table applied to the stated problem ("what is the chance of rolling two dice and at least one die is a 1 or 2?"). Using the graphic Ed Collins presents for the 36 possible combinations of rolling two six-sided dice, if you count all the cells in which either a 1 or a 2 appear, you get 20. Thus, 20 / 36 = 0.5556, as @redrum and @RoiEX calculated via other means.

                          B 1 Reply Last reply Reply Quote 3
                          • B Offline
                            beelee @ssoloff
                            last edited by

                            @ssoloff right on I come up with 24 ones or twos. Which ones should I not be counting ? Also I count 12 sixes in his example instead of 11.

                            When I do it the opposite way it all works fine.

                            ssoloffS 1 Reply Last reply Reply Quote 0
                            • ssoloffS Offline
                              ssoloff Admin @beelee
                              last edited by

                              I come up with 24 ones or twos. Which ones should I not be counting ?

                              @beelee The bold entries in the table below are the ones that should be counted:

                              :--: :--: :--: :--: :--: :--:
                              (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
                              (2,1) (2,2) (2,3) (2,4) (2,5) (2,6)
                              (3,1) (3,2) (3,3) (3,4) (3,5) (3,6)
                              (4,1) (4,2) (4,3) (4,4) (4,5) (4,6)
                              (5,1) (5,2) (5,3) (5,4) (5,5) (5,6)
                              (6,1) (6,2) (6,3) (6,4) (6,5) (6,6)

                              Remember, you're counting pairs of dice, not the individual dice themselves.

                              B 1 Reply Last reply Reply Quote 2
                              • prastleP Offline
                                prastle Moderators Admin @beelee
                                last edited by prastle

                                @beelee simple finite = (1/6 +1/6) x 2dice = 66% without going into vast explanation.

                                If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                                1 Reply Last reply Reply Quote 0
                                • B Offline
                                  beelee @ssoloff
                                  last edited by

                                  @ssoloff Cool ! Pairs of dice was where I was screwing up. Thanks for the explanation : )

                                  prastleP 3 Replies Last reply Reply Quote 0
                                  • prastleP Offline
                                    prastle Moderators Admin @beelee
                                    last edited by

                                    @beelee naw its more of the fact the extra hit isn't being counted in your ? 🙂 Triplea is looking at hits that could matter.

                                    If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                                    1 Reply Last reply Reply Quote 0
                                    • prastleP Offline
                                      prastle Moderators Admin @beelee
                                      last edited by

                                      @beelee it also isn't taking inot account subs have first strike ? 🙂

                                      If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                                      1 Reply Last reply Reply Quote 0
                                      • prastleP Offline
                                        prastle Moderators Admin @beelee
                                        last edited by

                                        @beelee ah missed the one round of combat part

                                        If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                                        B 1 Reply Last reply Reply Quote 1
                                        • B Offline
                                          beelee @prastle
                                          last edited by

                                          @prastle heh heh : ) I missed a lot more than that 🙂

                                          How you doing brother ?

                                          prastleP 1 Reply Last reply Reply Quote 0
                                          • prastleP Offline
                                            prastle Moderators Admin @beelee
                                            last edited by

                                            @beelee all good 🙂

                                            If we open a quarrel between past and present, we shall find that we have lost the future! Sir Winston Churchill

                                            1 Reply Last reply Reply Quote 1

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums