|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdip.process.RetreatChecker
RetreatChecker analyzes the current TurnState and the results of the previous TurnState to determine which (if any) retreat locations are acceptable for a retreating unit. Thus it is only dependent upon the adjudication results, and the current Position.
Basic Retreat Algorithm:
Constructor Summary | |
RetreatChecker(TurnState current)
Create a RetreatChecker. |
|
RetreatChecker(TurnState current,
java.util.List previousTurnStateResults)
Create a RetreatChecker. |
Method Summary | |
Location[] |
getValidLocations(Location from)
Gets all valid locations to which this unit may retreat. |
boolean |
hasRetreats(Location from)
Returns 'true' if at least one valid retreat exists for the dislodged unit in 'from' |
boolean |
isValid(Location from,
Location to)
Determines if the unit located in from can retreat to
the Location to |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RetreatChecker(TurnState current)
There must be at least one prior TurnState in the World object for this to work, however, if we a unit is Dislodged and it is the very first TurnState (this can happen if the game is edited), it is allowed.
public RetreatChecker(TurnState current, java.util.List previousTurnStateResults)
Useful for when the previous TurnState has not yet been inserted into the World object.
Method Detail |
public boolean isValid(Location from, Location to)
from
can retreat to
the Location to
public Location[] getValidLocations(Location from)
Returns a zero-length array if there are no acceptable retreat locations.
public boolean hasRetreats(Location from)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |