Adjudication Algorithm
about the DPjudge | the DPPD | DPjudge questions
Adjudication Procedure Supporting Data Structures
· Supporting Data Structures

· 
Mark Invalid Convoys
· Mark Invalid Moves and Supports
· Calculate Unit Strength
· Mark Endangered Convoys
· 
Mark Disrupted Convoys and Convoyed Support Cuts
· 
Mark Place-Swap Bounces
· 
Mark Undestrength Attack Bounces
· 
Mark Self-Dislodge Bounces
· 
Mark Supports Cut By Dislodgements
· 
Move Units

· 
Subroutines
  • Data maintained for each and every unit:
    • Order: the order to be issued (of course).
    • A textual mark (initially none) that indicates the status of the unit's order. All orders that emerge from the algorithm without a mark will succeed.
    • Support count: the number of valid supports given to this unit's order (initially zero). This number determines what is sometimes in the algorithm below called the unit's "strength"
    • No help list: a list of units owned by the same power as the unit being attacked and which are offering support to that unit in its attempt to move into an occupied space.
  • Data maintained for each and every space on the board:
    • Combat list: a list of all units attempting to enter (or remain in) the space. Successful attacks and defenses are decided using this list and the data concerning supports that is maintained for each of the units.
  • Data to assist in convoy resolution:
    • Convoying armies list: a list (initially empty) that will contain all units that have been issued a valid convoy order.
    • Convoy succeeded list: a list (initially empty) that will contain all armies whose convoy orders succeeded.
    Note that in games using the RULE PORTAGE_CONVOY, the convoying armies list and the convoy succeeded list will also contain convoying fleets. Furthermore, in such games, all steps in the algorithm below that involve convoy orders (and that refer in their text to convoying armies and to fleets that were issued convoy orders) are also executed with the roles of those two unit-types reversed, to determine the success of the orders of fleets being convoyed ("portaged").
Step 1. Mark All Invalid Convoy Orders
  • For all convoying armies:
    • If the convoy path given in the order is not a series of adjacent spaces each having the proper terrain type so to constitute a valid convoy order, mark the army's order as "void".
    • If trying to convoy through a non-existent fleet, either change the army's order to HOLD or mark the army's order as "no convoy" (the decision as to which should be done is based on a game option).
    • Otherwise, if trying to convoy through a fleet that did not order a matching convoy order, mark the army's order as "no convoy".
    • Otherwise, include this army in the "convoying armies list".
  • For all fleets issuing convoy orders:
    • If the army being convoyed does not exist, either change the fleet's order to HOLD or mark the fleet's order as "void" (the decision as to which should be done is based on a game option).
    • Otherwise, if the army being convoyed did not issue the matching order, mark the fleet's order as "void."
Step 2. Mark All Invalid Move and Support Orders
  • For all units issuing move (non-convoy) orders:
    • If the space that is the destination of the move order is not geographically adjacent to the unit's current space and one to which the unit may legally move, mark the order as "void".
  • For all units issuing support orders:
    • If the unit being supported does not exist, either change the supporting unit's order to HOLD or mark the order as "void" (the decision as to which should be done is based on a game option).
    • Otherwise, if the unit being supported did not issue the matching order, mark the supporting unit's order as "void".
    • Otherwise, if the space into which the support is being offered is not geographically adjacent to the unit's current space and one to which the unit may legally move, mark the order as "void".
    • Otherwise:
      1. Increment the "support count" of the supported unit.
      2. If the supported unit is attacking a position that is occupied by a unit owned by the same power that owns the supporting unit, add the supporting unit to the supported unit's "no help list".
Step 3. Calculate Initial Combat Strengths
  • For all non-convoyed move orders:
    • Execute the cutSupport procedure (found below).
  • For every space on the board:
    • Create a "combat list" containing all units that are attempting to either move to or remain in that space.
Step 4. Mark Support Cuts Made by Convoyers and Mark Endangered Convoys
  • For every army in the "convoying armies list":
    • Execute the checkDisruptions procedure (found below)
    • If the army's order is not marked, execute the cutSupport procedure for that army, and add the army to the "convoy succeeded list".
    • Otherwise (if the army's order is marked as "convoy endangered"), change the order's mark to "convoy under attack".
  • If the "convoy succeeded list" grew during this step, then repeat this step (that is, repeat this step until the list does not grow).
Step 5. Mark Convoy Disruptions And Support Cuts Made by Successful Convoys
  • For every army in the "convoying armies list":
    1. Execute the checkDisruptions procedure
    2. If the army's order is marked "convoy endangered":
      1. Change the order's mark to "no convoy".
      2. Set the number of supports the army is receiving to zero.
      3. Mark the order of every unit that is offering support to this unit (and whose order is not yet marked) as "no convoy".
    3. Otherwise, if the army's order is marked as "convoy under attack":
      1. Remove the army order's mark.
      2. Execute the cutSupport procedure for the army.
      3. Add the army to the "convoy succeeded list".
  • If the "convoy succeeded list" grew during this step, then return to step 4.
Step 6. Mark Bounces Caused by Inability to Swap Places
  • For all moving units that are not convoying and whose orders are not marked:
    • If the space to which the unit is moving is occupied by a unit
      1. whose order is not marked, and
      2. which is attempting to swap places with the first unit and
      3. which is not being convoyed,
      then call this other unit the "swapper".
    • If there is a "swapper", then
      1. If the unit and the swapper are both owned by the same player or if the "support count" for the unit, reduced by the number of supports in its "no help list" is not greater than the "support count" for the "swapper," then execute the bounce procedure for the unit.
      2. If the unit and the swapper are both owned by the same player or if the "support count" for the "swapper", reduced by the number of supports in its "no help list" is not greater than the "support count" for the unit, then execute the bounce procedure for the swapper.
  • If any unit's order was marked as "bounce" during this step, repeat this step (that is, repeat this step until no more orders become marked as "bounce").
Step 7. Mark Bounces Suffered by Understrength Attackers
  • For all spaces on the board:
    • For every unit in the "combat list" for that space:
      • If the unit meets all of the following requirements:
        1. does not have a greater "support count" than every other unit in the space's "combat list", and
        2. is attempting a move order, and
        3. that move order is not marked,
        then execute the bounce procedure (described below) for that unit.
  • If any unit's order was marked "bounce" during this step, return to step 6.
Step 8. Mark Bounces Caused by Inability to Self-Dislodge
  • For each space on the board:
    • If the "combat list" for that space includes one unit whose "support count" is greater than that of every other unit in the "combat list" for the space, and if
      1. the unit's order is not marked, and
      2. the unit is attempting a move order,
      then call the unit occupying the space to which the move is being made the "victim".
    • If there is a "victim", but the "victim" was issued a move order which is not marked, then there is no "victim".
    • If there is still a "victim", but if the "victim" is owned by the same power that owns the moving unit, there is no "victim". Execute the bounce procedure for the moving unit.
    • If there is still a "victim", then subtract the number of units listed in the moving unit's "no help" list from its "support count". If this result is no longer larger than the "support count" for all other units in the "combat list" for the space, execute the bounce procedure for the moving unit.
  • If any unit's order was marked "bounce" during this step, return to step 6.
Step 9. Mark Supports Cut By Dislodgements
  • For every moving unit whose order is not marked:
    • Execute the cutSupport procedure.
  • If any unit's order was marked "cut" during this step, return to step 6.
Step 10. Move Units That Did Not Bounce
  • For every moving unit whose order is not marked:
    • If the unit is moving to a space that is occupied by another unit, and if either that other unit is not moving or has an order that is marked, then
      1. Mark the other unit "dislodged".
      2. If the dislodged unit had attempted a non-convoyed move into the space from which its attacker came, and if the attacker also was not convoyed, then remove the dislodged unit from the "combat list" for the space from which the attacker came.
      3. Create the "possible retreats" list for the dislodged unit by listing all spaces on the board to which the unit could move without convoying, but do not list the space from which the dislodged unit's attacker came, nor any space that has a non-empty "combat list".
    • Execute the unbounce procedure for the space being vacated by the moving unit.
    • Move the unit to its destination space (that is, set its location to be the destination of its move order).
Subroutines Used By the Steps Above
cutSupport, executed for a particular moving unit
If the move is to a location occupied by a supporting unit that fits all of the following criteria:
  1. has an order that is not already marked as "cut" or "void",
  2. is not owned by the same power as the moving unit,
  3. if (and only if) the moving unit is a convoyed army:
    • the supporting unit is not offering support for or against any convoying fleet (whose order is not marked "void"), and
    • either we are executing Step 9 of the main algorithm or the supporting unit is not offering support for a move into the space from which the moving unit originated,
then do the following:
  1. Mark the supporting unit's order as "cut".
  2. Decrement the number of supports that the supported unit has.
  3. Remove the supporting unit from the supported unit's "no help list" (if it appears there).

checkDisruptions, executed for a particular convoying army
  • For every fleet in the army's convoy path:
    • If the "combat list" for the space occupied by the fleet contains a single unit with a higher support count than all others, and if that single unit is not owned by the same power that owns the convoying fleet, then mark the convoying army's order as "convoy endangered".
    • (If the RULE SAFE_CONVOYS is in use, an army's order is also marked "convoy engangered" if the combat list for the space occupied by the fleet has more than one unit tied with an equal greatest support count, and if at least one of these units is not owned by the same power that owns the convoying fleet, and if the convoying fleet is not itself one of these units.)

bounce, executed for a particular moving unit
  • Mark the unit's order as "bounce".
  • Add the unit, with a "support count" of 0 and an empty "no help" list, to the "combat list" for the space from which it attempted to move.

unbounce, executed for a particular space
  • If there is a single unit in the "combat list" of the space which has more strength than all others, and if this unit's order is marked "bounce," then
    • Remove the mark of "bounce" from that unit's order.
    • If the unit's order is marked "dislodged", then remove the mark of "dislodged" from that unit.
    • Otherwise (if the unit's order was not marked "dislodged"), remove the unit from the "combat list" of the space where it began the turn, and execute this unbounce procedure (recursively) for that space.
The DPjudge is copyright © 1995-2018 by Manus Hand. All rights reserved.