|
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: kept for units that were issued an order to
move into an occupied space, this is a list of units owned
by the power currently occupying that space and which were
ordered to support this unit's move order.
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 ("portaging") 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 "portaged".
|
|
Step 1. Mark All Invalid Convoy Orders
|
|
For each convoying army:
-
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 was not issued
a matching convoy order, mark the army's
order as "no convoy".
-
Otherwise, include this army in the "convoying armies list".
For each fleet issued a convoy order:
-
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 each unit issued a move (non-convoy) order:
-
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 each units issued a support order:
-
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:
-
Increment the "support count" of the supported unit.
-
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 each unit issued a move (non-convoy) order:
-
Execute the cutSupport procedure (found below).
For each 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":
-
Execute the checkDisruptions procedure
(found below).
-
If the army's order is marked "convoy endangered":
-
Change the order's mark to
"no convoy".
-
Set the number of supports the army is receiving to zero.
-
Mark each
unit that is offering support to this unit (and which
is not yet marked) as "no convoy".
-
Otherwise, if the army's order is marked as
"convoy under attack":
-
Remove the mark from
the army.
-
Execute the cutSupport procedure for the army.
-
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 each unit issued a move (non-convoy) order that is not marked:
-
If the space to which the unit is moving is occupied by a unit
-
whose order is not marked,
and
-
which is attempting to swap places with the first unit
and
-
which is not being convoyed,
then call this other unit the "swapper".
-
If there is a "swapper", then
-
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.
-
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 each space on the board:
-
For each unit in the "combat list" for that space:
-
If the unit meets all of the following requirements:
-
does not have a greater "support count" than
every other unit in the space's "combat list", and
-
is attempting a move order, and
-
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
-
the unit's order is not marked, and
-
the unit was issued 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 each 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 each 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
-
Mark the other unit "dislodged".
-
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.
-
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 any space that has
a non-empty "combat list", nor the space from which the
dislodged unit's attacker came, unless the attacker was
convoyed.
-
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).
|
|
Procedures Used By the Steps Above
|
|
cutSupport, executed for a particular moving unit
-
If the move is being made into a location that is occupied by a
supporting unit meeting all of the following criteria:
-
has an order that is not already marked as
"cut" or "void",
-
is not owned by the same power as the moving unit,
-
is not offering support for or against any of the moving
unit's "attack spaces", defined as follows:
-
The "attack space" of a unit that is not
moving via convoy is its own original location.
-
The "attack spaces" of a convoying army are the locations
of each of the convoying fleets (and only those
fleet locations).
then do the following:
-
Mark the supporting unit's order
as "cut".
-
Decrement the number of supports that the supported unit has.
-
Remove the supporting unit from the supported unit's "no
help list" (if it appears there).
checkDisruptions, executed for a particular convoying army
-
For each 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 endangered" 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 zero 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.
|
|