#530 Wrong tech upgrade when a 5 was rolled.


A friend was playing AA and rolled a tech upgrade. I got the roll email (PBEM from the MARTI server) and it said a 5 was rolled, but the game gave him heavy bombers. I realize it is possible he could have cheated by loading the game and re-rolling without it on PBEM mode, etc., but I really doubt he did this. Maybe you can just check the code to make sure a 5 is providing long range air and not heavy bombers. This was rolled by the U.S. if that matters.

We would have simply edited the game via edit mode, but it doesn't appear you can change technologies in edit mode.


  • matt

    OK, it is possible there is no bug, but a misunderstanding in how the dice are rolled for techs when a power already has a tech. In this case, the U.S. already had Super Subs. So I am guessing what is happening is that it was removed from the available tech list and therefore the 5th item was heavy bombers. I came to this realization when the U.S. later rolled a "1" for tech and got jet fighters. So I am thinking that maybe you have set the dice engine so it rolls between 1 and the # of available technologies. If that is the case, it might be nice for newbies if that information was somehow conveyed (or the displayed roll # adjusted and explained).

  • Sean Bridges
    Sean Bridges

    • priority: 5 --> 4
  • ComradeKev

    You're basically correct- the code does a MOD [int index = random[i] % available.size();] on the random roll (1-6) and how many techs are available (.size).

    This basically means it divides the random roll by the size and takes the remainder. that remainder then becomes the offset into the list of available techs.

    Suppose you have available:
    super subs
    heavy bombers
    jet fighters
    long range air

    This gives you an available size of 4. Suppose you roll a 6. 6 MOD 4 is 6/4 or 1 with a remainder of 2

    2 is now your index into the available techs.... but it's 0 based, and so your rolled tech would be jet fighters.

    Long story short- it's basically random.

  • ComradeKev

    • status: open --> closed-rejected
  • Chris Duncan
    Chris Duncan

    wait, so kev.... let me walk through this...
    rolling a
    1) gives super subs
    2) gives heavy bomber
    3) gives jet fighter
    4) gives long range air
    5) gives heavy bomber
    6) gives jet fighters

    yes, while this is random, it also doubles the chance of getting heavy bombers and jet fighters....
    wouldn't it be better to just re-roll if you hit something that has already been given?

  • Chris Duncan
    Chris Duncan

    • priority: 4 --> 5
    • status: closed-rejected --> open
  • Chris Duncan
    Chris Duncan

    • status: open --> pending-fixed
  • Chris Duncan
    Chris Duncan

    should be fixed by squid daddy's patch

  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 60 days (the time period specified by
    the administrator of this Tracker).

    • status: pending-fixed --> closed-fixed