• 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


  • My opponent in a game sent me a calculator that does europe pacific regular etc, and is quite advanced. Don’t know how i can post it…


  • I don’t wish to hurt anyone’s pride – and I do think the formulas, logarithms, and constructions are a testament to imagination, persistence, resourcefulness and yes even FUN – but reading through these posts makes me realize how much I LIKE ROLLING DICE!!! YEEEHOOO!!

    Anyone think that’s strange??


  • of course the dice are fun, you never know, you might get lucky! but calculators are important. Without a calculator, for large battles, the odds can be 90%+ or <10% and it’s really hard to tell which it is usually.


  • Ah, yes: the famous “fog of war” in its manifestation on the diceboard!

Suggested Topics

  • 2
  • 6
  • 5
  • 41
  • 10
  • 5
  • 2
  • 16
Axis & Allies Boardgaming Custom Painted Miniatures

34

Online

17.4k

Users

39.9k

Topics

1.7m

Posts