• Hi…
    Just thought I’d post it in this forum to, since not all read the pacific forum.
    I’ve done an odds calulator for A&A, it can be used for all three games
    (A&A, Europe and Pacific). Just grab and try it at my homepage, and
    notify me of any bugs or ideas to make it better so that i can release the final version…
    And hopfully get it in as an download on this page :wink:

    Get it at:
    http://home.swipnet.se/~w-43238/

    Read the readme file for instructions…

    //Samael


  • good job!

    seems to work pretty well, but is there any way you can make it work without the dot net framework?

    this will be excellent either way


  • I’m am currently working on a converison to Java wich will make it plattform independent, and it will be able to be accessed online too.
    But it’ll probebley be a litte slower then the C# version, depending on the JVM :-? , I’ll try to optimize it… I’ll let you know when it’s done.

    Shouldn’t take to long… the code for the calculations should be pretty much the same…

    //Samael


  • from what i can tell, you do n rounds where n is high and give the result. I was considering an odds calculator that is “correct” by using infinite series and calculus (calculate limits by taking derivatives) just and idea, i can try to post and example if you like… also, would be great to have all the separate outcomes, or the 10 most likely like batsim. It’s really great to see what the most likely outcome is. Your calculator does have the great advantage of supporting pacific though. I will be using it for my pacific games.


  • Yes, it does n rounds and calculate the odds from that.
    I thought about doing it a more “sientific” way… but got stuck at the Calculus, so if you can give me a push in the right direction it’ll be great. :D
    I’ll add more features as I go along, so the most likley outcome’s will be in there… just hang on… :D

    Great pointers though… thanx…

    //Samael


  • here is one theory:
    in a tank vs inf battle:

    in the following image, the red represents total death
    green represents tank winning
    blue is infantry win
    white represents the next round

    i filled in the white space:

    anyway the idea is what’s in the white space doesn’t matter, you can find the odds from the first image, as the infinite series proves. Half the area is green, one fourth of the area is blue, one fourth is red

    if your program could do this it would be able to do total odds
    there are 2 problems:
    1. it only does one round at a time.
    this could be overcome with a weighted system, and using a recursive function to calculate each round…

    2. It only works with battles of 1 unit on each side!!
    this can be overcome easily you would create a matrix for the attack, and insert it into the defence matrix (or vice versa) The main problem here is that the dimention is the maximum number of units on either side which in a battle of 10 units on one or both sides would result in a 10 dimetional matrix of (6*10)^10 ints requiring 57 gig of memory! better not make that recursive!!

    it would work for small battles though, and i’m sure there is a way to optimize it (adding areas) so that it doesn’t use that much memory

    also, i’m not sure but you could possibly use the heavyside function and laplace transforms in an infinite series (i wonder if i could make that work!)
    i just learned about those in school…

    if you have any questions or anything feel free to ask
    you could of course, stick to the random number generator as well
    what do you think?


  • It seems lika an interesting idea, but I think with large armies (German assault on a Stacked Russian) will soon lead to trouble and veary komplex computations…
    And what will happend when 2 battleships engage eachother in Pacific/ Europe, when they have two hits each…

    I think it’ll lead to lots of work… but I’m willing to try to write the code… I like a challange :D

    If you have the time i would like to see a more direct calculation of this so I can see how to implement all this in the code… I hade some ideas like this when I started writning the code… But I realized that whit enough repetitions you’ll get basicly the same result… But your way should be faster to computate then 5000 dice rolls… :D…

    //Samael


  • yeah, i will try to figure it out some more with an algorithm not completely sure how to code it yet, i am also a programmer, so i should be able to explain it better. I should have some time after my exams this week in school…


  • Sure, that would be nice…
    Maybe we can work togheter on this to optimize the code??
    If you have the time…
    //Samael


  • yes, i was thinking of actually adding areas would make this method feasable.

    for instance, the battle i showed about what you would do (again 1 round at a time for now) is create an array of floats for hit% the attacker makes. this would be something like:

    float *ahits=new float[MAXHITSATTACK+1]; //max hits is the maximum number of hits, in this case 1 not a constant
    float *dhits=new float[MAXHITSDEFENCE+1];
    //make all values of these zero;

    for(….) //loop through attacking units
    //here is the cool part:
    //for a tank take half of what’s in a hits, and shift it up, the rest stays where it is, //and you add .5 to ahits[0] and ahits [1]
    for(int i=MAXHITSATTACK-1;i>=0;i–)
    {
    ahits[i+1]+=ahits_(attackvalue/6); //attackvalue is 3 for a tank
    ahits_
    =(attackvalue/6); //if it misses
    }
    do the same for defence. There is a way to intertwine them to actually get the most likely odds as well. But this will give you an array, the greatest element being the most likely number of hits. I’ll try to figure out how to get attack and defence working together, i know it’s possible. Then i can work on multiple rounds, that’s the hardest part. Could of course use recursion for say the 10 most likely outcomes of each round, but overtime this ruins accuracy. With full recursion, and large battles, i’m sure it would crash.__


  • //here is the cool part:
    //for a tank take half of what’s in a hits, and shift it up, the rest stays where it is, //and you add .5 to ahits[0]

    Isn’t all the cells in the array set to zero? or should something happend before that that is’nt stated?..
    If i use it as it says and then add 0.5 and do the inner for loop it seems that the result will be0.75 to hit and 0.25 to miss… wich clearly is’nt right… or am I missing the point here…
    I’ll go home and pull out “ye old calculus” books to see if i can lend a hand in solving the problem…

    //Samael


  • ok i messed it up ahits[0] should be set to 1, all the other values should be zero so:

    for(int i=MAXHITSATTACK-1;i>=0;i–)
    {
    ahits[i+1]+=ahits_(attackvalue/6); //attackvalue is 3 for a tank
    ahits_
    =(attackvalue/6); //if it misses
    }
    i think this works
    after one tank is entered i get:
    ahits={.5, .5}
    after a second is entered i get:
    ahits={.25,.5,.25}

    so all i need to do is combine them to make attack and defence work together in possibly a 2d array.__


  • What do you mean with this line here?
    //for a tank take half of what’s in a hits, and shift it up, the rest stays where it is

    As I understand it it should be something like this…
    for(int i=0; i<=MAXATTHITS; i++)
    {
    float half = (ahits_/2);
    ahits _-= half;
    ahits[i+1] += half;
    }
    and then add .5 to all the cells?

    Or have I gotten it completly wrong??
    I can’t get it to work with more than 1 attacking unit…

    //Samael__


  • note: it is in reverse order, i– this is important due to the nature of the algorithm

    for(int i=u;i>=0;i–) //changed it to i=u, u is the counter for the outer loop this increases efficiancy
    {
    ahits[i+1]+=ahits_(attackvalue/6); //attackvalue is 3 for a tank
    ahits_
    =(attackvalue/6); //if it misses
    }

    for 2 tanks
    for tanks attackvalue=3 so (attackvalue/6) is always .5
    when i enter a tank, and i=0 (u=0) then
    ahits[1]+=ahits[0].5
    which is:
    ahits[1]+=.5 (ahits[1]=.5)
    then
    ahits[0]
    =.5 (ahits[0]=.5)

    ahits={.5,.5};

    for the second tank, i=1;
    ahits[2]+=ahits[1].5
    which is:
    ahits[2]+=.5
    .5=.25 (ahits[2]=.5)
    then
    ahits[1]=.5 (ahits_=.25)
    now ahits={.5,.25,.25} but we have to do when i=0 also
    ahits[1]+=ahits[0]
    .5
    which is:
    ahits[1]+=.5*.5
    ahits[1]=ahits[1]+.25 (ahits[1]=.5)
    then
    ahits[0]=.5
    ahits[0]=.5
    .5=.25 (ahits[0]=.25)

    so after 2 tanks ahits={.25,.5,.25} 25% miss, 50% 1 hit, 25% 2 hits
    i might code this up for a special purope, in the meantime, you could try to get it to work. I’ll work on the 2d array so i can get say 25% attack hits once, defence hits twice, or whatever, then to do multiple rounds…___


  • oops… my bad…
    Forgott the outer for loop :oops:

    It works fine now… I’m working with another theory that might work
    better when removing casualites… but i’m not sure how it’ll work out…
    I’ll let you now…

    //Samael


  • Do you have an updated version out yet?

    Maybe you could include rules for some variations.


  • do you mean his calculator, or my theory? I haven’t actually compiled mine yet, but I know a good use for it…


  • I haven’t done any work on the calculator since version 1.1b, there just has’nt been time… I’ll post a non .NET version shortly though…
    Lots of projects in the making though… :D

    Inxduk: How are your calculations going along?
    If you wish I could send you the GUI and you can just implement your calculatoins to test them… Just have them in Visual C++ C or Visual C# 7 though…

    //Samael


  • I have the full version of VC++ 6.0 which is old, but works. I’m mainly to lazy to program it in due to my other projects


  • Hey Sam,
    I downloaded your version 1.1b.
    Lookin’ great! :wink:
    nice icon/piccys, looks very professional.
    works perfect too

Suggested Topics

  • 2
  • 6
  • 8
  • 10
  • 2
  • 1
  • 1
  • 16
Axis & Allies Boardgaming Custom Painted Miniatures

43

Online

17.4k

Users

39.9k

Topics

1.7m

Posts