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

· 
Mark Invalid Orders
· Mark Invalid Convoys
· Mark Invalid Supports
· Calculate Unit Strength
· Determine Convoy Success
· Mark Endangered Convoys
· Mark Disrupted Convoys
· 
Determine Bounces and Further 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) which indicates the status of the order. The order for any unit 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 piece being attacked which are offering support to the unit in its attempt to move into an occupied space.
  • Data maintained for each and every space on the board:
    • Combat list: 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) to contain all units whose convoy orders succeeded.
Step 1. Mark All Invalid Convoy Orders
  • For all convoying armies:
    • If trying to convoy through a non-existent fleet, either change the army's order to HOLD or mark the army "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 "no convoy."
    • Otherwise, include this army in a "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 "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 "void."
Step 2. Mark All Invalid Support Orders
  • 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 it "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 "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 is not marked, execute the cutSupport procedure for that army, and add the army to the "convoy succeeded list."
    • Otherwise (if the army is marked "convoy endangered"), change the army's mark to "convoy under attack."
  • If the "convoy succeeded list" grew during this step, then repeat this step.
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 is marked "convoy endangered,"
      1. Change its mark to "no convoy."
      2. Set the number of supports the army is receiving to zero.
      3. Mark as "no convoy" all unmarked units that are offering support to this unit.
    3. Otherwise, if the army is marked "convoy under attack,"
      1. Remove the army'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 are not marked:
    • If the space to which the unit is moving is occupied by a unit that is
      1. not marked, and
      2. attempting to swap places with the first unit, and
      3. 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 was marked "bounce" during this step, repeat this step.
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,"
        2. is attempting a move order, and
        3. is not marked,
        then execute the bounce procedure (described below) for that unit.
  • If any unit 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 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 and 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 was marked "bounce" during this step, return to step 6.
Step 9. Mark Supports Cut By Dislodgements
  • For every moving unit that is not marked:
    • Execute the cutSupport procedure.
  • If any unit was marked "cut" during this step, return to step 6.
Step 10. Move Units That Did Not Bounce
  • For every moving unit that is not marked:
    • If the unit is moving to a space occupied by another unit, and if that other unit is either marked or not moving, 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 with a "combat list."
    • Execute the unbounce procedure for the space being vacated by the moving unit.
    • Move the unit to its destination space.
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. is not already marked "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
  4. 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 "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 as "convoy endangered."
    • (If the RULE SAFE_CONVOYS is in use, an army 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 one of these units.)

bounce, executed for a particular moving unit
  • Mark the unit "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 is marked "bounce," then
    • Remove the mark of "bounce" from that unit.
    • If the unit is marked "dislodged," then remove the mark of "dislodged" from that unit.
    • Otherwise (if the unit 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-2010 by Manus Hand. All rights reserved.