|
Internet Chess ToolKit v0.2.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ictk.boardgame.Move
A move contains all the necessary components to make a move on the board. Whether it be simply placing a piece at a location, moving pieces around or taking a piece off the board, a Move is the embodyment of a player action for one turn.
The Move is an implementation of a Command Pattern. It is sent to its Board object via the Board.play(Move) or more commonly History.add(Move); (the latter being prefered -- see those methods for a more detailed explaination of why. When execute() is called on the Move it performs all the operations necessary on the Board's state. unexecute() rolls back any changes made by execute().
Move contains mostly references to other objects. From this move there branches a tree of other moves called "continuations". Continuations include the main-line (which was how the official game was played) and a list of variations (where are possible continuations of the game). These can all be accessed through the getContinuationList() method.
There are two two phases to the Move object
1) unverified
The move is but coordinates, not associated with a board or
history list. There is no guarentee that the move is valid.
Executing a method that relies on valid information will result
in an UnexecutedMoveException. This is very rare, however, since
most Move objects are verififed and validated immediately upon
creation.
2) verified
The move has been executed at least once on the corrisponding board
and verified to be a legal move. At this point all information
about the move can be assertained including such things as
isCheckmate() (for ChessMoves).
Constructor Summary | |
Move()
|
Method Summary | |
void |
dispose()
reclaims all resources and recursively deletes all branch moves. |
java.lang.String |
dump()
for debugging |
Annotation |
getAnnotation()
returns an object full of comments on the move or the board position. |
abstract Board |
getBoard()
|
ContinuationList |
getContinuationList()
returns the ContinuationList of moves that follow this move. |
History |
getHistory()
|
Move |
getNext()
get the next move in the game history. |
Annotation |
getPrenotation()
returns an object full of comments that are supposed to be read before the move these comments are attached to. |
Move |
getPrev()
gets the move previous to this move. |
Result |
getResult()
returns the current game result on this move. |
boolean |
hasNext()
checks to see if there is a main-line continuation from this move. |
boolean |
isExecuted()
has this move currently been executed on its board |
abstract boolean |
isLegal()
|
boolean |
isVerified()
has the move been verified to be legal (this usually follows a successful execute(), though the move might not be isExecuted currently. |
void |
setAnnotation(Annotation anno)
by default the annotation object is null. |
void |
setPrenotation(Annotation anno)
by default the prenotation object is null. |
void |
setResult(Result res)
sets the result. |
abstract java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Move()
Method Detail |
public History getHistory()
public abstract Board getBoard()
public ContinuationList getContinuationList()
public Move getPrev()
public boolean hasNext()
public Move getNext()
public void dispose()
java.lang.IllegalStateException
- if the move is executedpublic abstract boolean isLegal()
public boolean isExecuted()
public boolean isVerified()
public Annotation getPrenotation()
public void setPrenotation(Annotation anno)
public Annotation getAnnotation()
public void setAnnotation(Annotation anno)
public Result getResult()
public void setResult(Result res)
public abstract java.lang.String toString()
public java.lang.String dump()
|
Submit a bug or feature Visit the Website Internet Chess ToolKit is licensed under the GPL v2 . |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |