|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dip.order.Order dip.order.Move
Implementation of the Move order.
This has been updated to support the 2003-Dec-16 DATC, specifically, section 4.A.3.
Field Summary | |
protected boolean |
_fmtIsAdjWithConvoy
|
protected boolean |
_hasLandRoute
|
protected boolean |
_isAdjWithPossibleConvoy
|
protected boolean |
_isConvoyIntent
|
protected boolean |
_isViaConvoy
|
protected java.util.ArrayList |
convoyRoutes
|
protected Location |
dest
|
Fields inherited from class dip.order.Order |
ORD_VAL_BORDER, power, src, srcUnitType |
Constructor Summary | |
protected |
Move()
Creates a Move order |
protected |
Move(Power power,
Location src,
Unit.Type srcUnitType,
Location dest)
Creates a Move order |
protected |
Move(Power power,
Location src,
Unit.Type srcUnitType,
Location dest,
boolean isConvoying)
Creates a Move order, with optional convoy preference. |
protected |
Move(Power power,
Location src,
Unit.Type srcUnitType,
Location dest,
java.util.List routes)
Creates a Move order with multiple explicit convoy routes. |
protected |
Move(Power power,
Location src,
Unit.Type srcUnitType,
Location dest,
Province[] convoyRoute)
Creates a Move order with an explicit convoy route. |
Method Summary | |
void |
determineDependencies(Adjudicator adjudicator)
Dependencies for a Move order: NOT ADDED: convoy route, if it is a convoyed move note that while a move would depend upon a convoy route, individual convoy orders are not helpful because there may be multiple paths to a destination. |
boolean |
equals(java.lang.Object obj)
Determines if the orders are equal. |
void |
evaluate(Adjudicator adjudicator)
NOTE: this description may be slightly out of date evaluation of Move orders. |
protected java.lang.String |
formatConvoyRoute(Province[] route,
boolean isBrief,
boolean useHyphen)
Format a convoy route into a String |
protected void |
formatConvoyRoute(java.lang.StringBuffer sb,
Province[] route,
boolean isBrief,
boolean useHyphen)
Format a convoy route into a StringBuffer |
java.lang.String |
getBriefName()
Returns the Brief name of the Order (e.g., "H" for a Hold order) |
Province[] |
getConvoyRoute()
Returns, if set, an explicit convoy route (or the first explicit route if there are multiple routes). |
java.util.List |
getConvoyRoutes()
Returns, if set, all explicit convoy routes as an unmodifiable List. |
java.lang.String |
getDefaultFormat()
Get the default OrderFormat String used to custom-format orders. |
Location |
getDest()
Returns the destination Location of this Move |
java.lang.String |
getFullName()
Returns the Full name of the Order (e.g., "Hold" for a Hold order) |
boolean |
isAdjWithPossibleConvoy()
Returns true if an Army can possibly Move to its destination with a convoy, even though it is adjacent to its destination. |
boolean |
isConvoying()
This is implemented for compatibility; it is no different than isConvoyIntent() . |
boolean |
isConvoyIntent()
Returns true if the Intent of this Move order is to Convoy. |
boolean |
isViaConvoy()
Returns true if this Move was explicitly ordered to be by convoy, either by specifying "by convoy" or "via convoy" after the move order, or, by giving an explicit convoy path. |
java.lang.String |
toBriefString()
Prints the entire order, in a brief syntax |
java.lang.String |
toFullString()
Prints the entire order, in a verbose syntax |
void |
validate(TurnState state,
ValidationOptions valOpts,
RuleOptions ruleOpts)
Validate the order. |
protected void |
validateTheoreticalConvoyRoute(Position position)
Determines if this move has a theoretical explicit or implicit convoy route. |
void |
verify(Adjudicator adjudicator)
Verify this move given completely-known game state. |
Methods inherited from class dip.order.Order |
addSupportsOfAndMovesToSource, appendBrief, appendFull, checkPower, checkSeasonAdjustment, checkSeasonMovement, checkSeasonRetreat, getPower, getSource, getSourceUnitType, getValidatedUnitType, toFormattedString, toString, validate |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Location dest
protected java.util.ArrayList convoyRoutes
protected boolean _isViaConvoy
protected boolean _isConvoyIntent
protected boolean _isAdjWithPossibleConvoy
protected boolean _fmtIsAdjWithConvoy
protected boolean _hasLandRoute
Constructor Detail |
protected Move()
protected Move(Power power, Location src, Unit.Type srcUnitType, Location dest)
protected Move(Power power, Location src, Unit.Type srcUnitType, Location dest, boolean isConvoying)
protected Move(Power power, Location src, Unit.Type srcUnitType, Location dest, Province[] convoyRoute)
protected Move(Power power, Location src, Unit.Type srcUnitType, Location dest, java.util.List routes)
Method Detail |
public Location getDest()
public boolean isViaConvoy()
Note that this is not always true for all convoyed moves; to check if a move is convoyed, see isConvoying().
Note that explicitly ordering a convoy doesn't really matter unless there are both a land route and a convoy route. See Dec-16-2003 DATC 6.G.8.
public boolean isAdjWithPossibleConvoy()
Important Note: This value will not be properly determined
until validate()
has been called.
public boolean isConvoyIntent()
validate()
has been
called.verify()
has been called.verify()
has been called.
public boolean isConvoying()
isConvoyIntent()
.
public Province[] getConvoyRoute()
public java.util.List getConvoyRoutes()
public java.lang.String getFullName()
Orderable
public java.lang.String getBriefName()
Orderable
public java.lang.String getDefaultFormat()
Orderable
public java.lang.String toBriefString()
Orderable
public java.lang.String toFullString()
Orderable
public boolean equals(java.lang.Object obj)
Order
Note that full equality MUST be implemented for each subclassed Order object! Subclasses are advised to call the super method for assistance.
equals
in class Order
public void validate(TurnState state, ValidationOptions valOpts, RuleOptions ruleOpts) throws OrderException
Order
This checks the order for legality. An order is not considered to be well-formed until it has been validated. It validates locations (at the least), and other order syntax as appropriate, throwing exceptions if there is a conflict.
This is used by the UI to flag bad orders, as well as by the adjudicator to eliminate bad orders before processing.
Important Note:
The only state that should be assumed is the following: 1) orders for this power (if entered) 2) the positions of all units. Thus, the orders of units not controlled by this power may not be known (in multiplayer games, this information would not be available until adjudication took place). DO NOT assume order information for the units of any power other than that of this unit/order!
Usage Notes:
Subclasses should generally call super.validate() before performing additional validation.
There should be no side effects of calling validate() multiple times, nor should behavior differ between multiple calls of validate(), given the same order.
validate
in interface Orderable
validate
in class Order
state
- Current turn statevalOpts
- Current validation options
OrderException
protected void validateTheoreticalConvoyRoute(Position position) throws OrderException
This will only throw an OrderException if there is an Explicit convoy path that is bad (doesn't contain src and dest in route, or doesn't form a route from src->dest), or if there is no implicit theoretical route from src->dest.
An implicit route is assumed if no explicit route has been set.
OrderException
protected java.lang.String formatConvoyRoute(Province[] route, boolean isBrief, boolean useHyphen)
protected void formatConvoyRoute(java.lang.StringBuffer sb, Province[] route, boolean isBrief, boolean useHyphen)
public void verify(Adjudicator adjudicator)
Verification must always be performed after strict order validation.
Verify does the following for Move orders:
Legal convoy routes are defined as a possible (or "theoretical") convoy route (i.e., an unbroken chain of adjacent fleets briding the source and destination), that also have Convoy orders that match this Move.
public void determineDependencies(Adjudicator adjudicator)
If destination is a move order, then that move order must be evaluated for an order to succeed. (taken care of by evaluate)
We also determine if this is a head-to-head move order; if so, the head-to-head flag of OrderState is set. A Head-To-Head move is defined as:
A->B and B->A, where neither B nor A is convoyed.Note that head-to-head determination may not be complete until verification is complete, as it depends upon whether this and/or an opposing move is convoyed.
public void evaluate(Adjudicator adjudicator)
evaluation of Move orders. The algorithm is as follows: ====================================================== 1) calculate support of this move (certain & uncertain) 2) if this is a convoyed move, evaluate convoy route a) if convoy route fails, move fails b) if convoy route uncertain, cannot evaluate move yet c) if convoy route ok, move can be evaluated. 3) determine order of unit in destination space a) no unit, or unit with Support/Convoy/Hold order 1) calculate strengths of all other moves to destination (if present) this is calculated by the evaluate() method for each Move order, so several iterations may be required before strengths are in the 'useful' area. 2) calculate defending unit strength (if present; if not, defense_max == 0) this is calculated by the evaluate() method for the respective order, similar to 3.a.1 3) compare attack_certain (of this move) to attack_max of all other attacks, and defense_max of destination. a) if another Move order to destination succeeded, then FAILURE b) if attack_certain > *all* of the defenders' (attack_max && defense_max) SUCCESS, unless defender is of the same power, in which case FAILURE if SUCCESS, defender (if present) is dislodged c) if attack_max <= *any* of the defenders' attack_certain or defense_certain FAILURE (since there would be no way to overcome this difference, regardless of support!) this is a "BOUNCE" [note: this is a key point] d) otherwise, we remain UNCERTAIN b) self support in cases with self support, the following changes to 3.a are noted below: 1) self support is used to determine strength against other moves (standoffs) to the destination province. 2) self support is NOT used to determine strength against *this* move to the destination province. Self-support can never be used to dislodge a unit, however, if a unit has enough strength to dislodge, self-support does not prohibit dislodgement. MODIFICATION (6/2/02): Self support *may* be used to determine the strength of this move to the destination province; if the unit in the destination province has succesfully moved out, we must compare against all other moves to dest (as in 1) but the self support can cause us to prevail against other moves to dest as well. Self-support cannot be used in the dislodge calculation, nor can it prohibit dislodgement. b) unit with Move order, NOT head-to-head (see below for definition) evaluate as 3.a.1-3 however: 1) if we are stronger: (guaranteed success, unless self) a) if destination move FAILURE, unit is dislodged, unless self; if self, we fail b) if destination move SUCCESS, unit is not dislodged, we succeed (if self or not) c) if destination move UNCERTAIN, unit is "maybe" dislodged, unless self; if self, we remain uncertain 2) if we are not stronger (equal-strength) a) we fail, ONLY if we are 'definately' not stronger (atk.max < def.certain) b) if destination move SUCCESS, we succeed c) if destination move UNCERTAIN, we remain uncertain. c) unit is a head-to-head MOVE order definition: destination unit is moving to this space, and NEITHER unit is convoyed (note: this is set when dependencies are determined) 1) evaluate as 3.a.1-3, with the following caveats applied to this vs. head-to-head move: - we use atk_certain/atk_max of 'head-to-head' unit a) same as 3.a.3.a b) same as 3.a.3.b [opposing unit dislodged; NOT a 'maybe' dislodged] BUT, opposing unit move is marked FAILURE c) same as 3.a.3.c d) same as 3.a.3.d d) comparing against head to head: if comparing against a head-to-head battle, where a unit may be dislodged, remain uncertain until we know if the unit is dislodged; if unit dislodged by head-to-head player, it cannot affect other battles A->B B->A D->B (and dislodges B) : no change HOWEVER, A->B, B->A, C->A, and A dislodges B (head to head), C can move to A. B does not standoff C because it was dislodged by A in a head-to-head battle. This is seen in DATC cases 5.A and 7.H (if no "by convoy" is used). 1) isHeadToHead() && EvalState == UNCERTAIN *or* head-to-head part unevaluated: UNCERTAIN result. 2) isHeadToHead() && EvalState == FAILURE: if disloger == head-to-head, then ignore (do nothing) 3) otherwise, process normally. IMPORTANT: A move that is 'dislodged' or 'fails' may still offset other moves, and still cut support. ALSO IMPORTANT: we create dislodged results, instead of failed results, for moves that are definately dislodged. The adjudicator will create, later, dislodged results for 'maybe' dislodged orders.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |