com.editev.chess
Class GameMoves
java.lang.Object
|
+--com.editev.chess.Chess
|
+--com.editev.chess.Board
|
+--com.editev.chess.GameState
|
+--com.editev.chess.Game
|
+--com.editev.chess.EnumeratedGame
|
+--com.editev.chess.GameMoves
- Direct Known Subclasses:
- GameHistory
- public class GameMoves
- extends EnumeratedGame
A GameMoves is an EnumeratedGame with a list of legal Moves for that Game.
- See Also:
the source here.
|
Field Summary |
(package private) Moves |
allMoves
Store all the legal next moves from this board position. |
static short |
MAX_MOVES
Estimate of max legal moves per position: max ever actually recorded in a random game is 71. |
private java.util.Enumeration |
moveEnumeration
An enumeration of all the legal moves, might be null or partially consumed. |
protected boolean |
movesCompleted
Have we enumerated ALL the next moves for this position yet? |
protected boolean |
movesEnumerated
Have we enumerated the next moves for this position yet? |
|
Method Summary |
byte |
applyMove(Move move)
Apply a specific move to this Game. |
protected void |
computeMoves()
Compute all the legal moves. |
protected void |
computeMoves(short moveNeeded)
Computes all next legal moves up to a certain move index. |
Move |
getMove(short move)
|
short |
getMoveCount()
Count all the the possible legal moves -- don't call this if you want to avoid enumerating
all possible legal moves for efficiency reasons, go right to getMove(). |
protected java.util.Enumeration |
getMoveEnumeration()
Retrieves or creates an enumeration of all the legal moves. |
| Methods inherited from class com.editev.chess.GameState |
canBeCaptured,
canMove,
clearEP,
getEP,
getMoves,
getReversibleMoves,
incrementMoves,
irreversibleMove,
isWhiteMove,
kingMoved,
moveKing,
moveRook,
rookMoved,
setEP |
| Methods inherited from class com.editev.chess.Board |
clone,
cloneBoard,
copyFrom,
equals,
findPieceSquare,
getPiece,
getPiece,
getPieceIndex,
getPieceIndex,
hasPiece,
inCheck,
isAttacked,
resultsInCheck,
setPieceIndex,
toString |
| Methods inherited from class java.lang.Object |
,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
MAX_MOVES
public static final short MAX_MOVES
- Estimate of max legal moves per position: max ever actually recorded in a random game is 71.
allMoves
final Moves allMoves
- Store all the legal next moves from this board position.
movesEnumerated
protected boolean movesEnumerated
- Have we enumerated the next moves for this position yet?
movesCompleted
protected boolean movesCompleted
- Have we enumerated ALL the next moves for this position yet?
moveEnumeration
private java.util.Enumeration moveEnumeration
- An enumeration of all the legal moves, might be null or partially consumed.
GameMoves
public GameMoves()
getMoveCount
public short getMoveCount()
- Count all the the possible legal moves -- don't call this if you want to avoid enumerating
all possible legal moves for efficiency reasons, go right to getMove().
- Returns:
- count of the number of legal next Moves for this Game.
getMove
public Move getMove(short move)
- Parameters:
move - the index of the legal move we're locating.- Returns:
- the legal move at this location -- only computes legal moves up to this point for efficiency.
getMoveEnumeration
protected java.util.Enumeration getMoveEnumeration()
- Retrieves or creates an enumeration of all the legal moves.
- Returns:
- an Enumeration of all the legal moves.
computeMoves
protected void computeMoves(short moveNeeded)
- Computes all next legal moves up to a certain move index.
- Parameters:
moveNeeded - the index of the last legal move we need (or Short.MAX_SHORT for all!)
computeMoves
protected void computeMoves()
- Compute all the legal moves.
applyMove
public byte applyMove(Move move)
- Apply a specific move to this Game.
Apply the move to the parent class -- but then invalidate the stored list of legal moves.
- Overrides:
- applyMove in class Game
- Returns:
- the index of the captured piece, if any (special case for ep).
- See Also:
com.editev.chess.Game.