com.editev.chess
Class GameHistory
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
|
+--com.editev.chess.GameHistory
- Direct Known Subclasses:
- GameHTML
- public class GameHistory
- extends GameMoves
A GameHistory is a GameMoves with a history of previous moves.
- See Also:
the source here.
|
Field Summary |
static int |
A_LONG_GAME
Number of moves in a long game. |
com.editev.util.Lists.Bytes |
blackCaptures
Lists of the pieces captured by Black. |
Moves |
moveHistory
A list of the moves already applied. |
com.editev.util.Lists.Shorts |
moveIndices
A list of the move indices already applied. |
static java.lang.String |
SEPARATOR
Separates move in a Move description string. |
com.editev.util.Lists.Bytes |
whiteCaptures
Lists of the pieces captured by White. |
|
Method Summary |
byte |
applyMove(Move move)
Apply a specific move to this Game and add it to the history! |
byte |
applyMove(short move)
Apply a move by index to this board. |
void |
applyMoves(java.lang.String moveString)
Apply a whole list of moves to this game. |
void |
capture(byte piece,
boolean isWhite)
Add a piece to the list of captured pieces |
com.editev.util.Lists.Bytes |
getCaptured(boolean isWhite)
Get the list of pieces captured by this color. |
java.lang.String |
getMoveString()
|
static void |
main(java.lang.String[] args)
Test this class by randomly playing an awful lot of games. |
boolean |
moveRandomly()
Pick a move at random from all the legal moves and apply it. |
| 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 |
A_LONG_GAME
public static final int A_LONG_GAME
- Number of moves in a long game.
Nearly all games should be shorter than this length for best performance.
moveHistory
public final Moves moveHistory
- A list of the moves already applied.
moveIndices
public final com.editev.util.Lists.Shorts moveIndices
- A list of the move indices already applied.
whiteCaptures
public final com.editev.util.Lists.Bytes whiteCaptures
- Lists of the pieces captured by White.
blackCaptures
public final com.editev.util.Lists.Bytes blackCaptures
- Lists of the pieces captured by Black.
SEPARATOR
public static final java.lang.String SEPARATOR
- Separates move in a Move description string.
GameHistory
public GameHistory()
getCaptured
public com.editev.util.Lists.Bytes getCaptured(boolean isWhite)
- Get the list of pieces captured by this color.
capture
public void capture(byte piece,
boolean isWhite)
- Add a piece to the list of captured pieces
applyMove
public byte applyMove(Move move)
- Apply a specific move to this Game and add it to the history!
- Overrides:
- applyMove in class GameMoves
- Returns:
- the index of the captured piece, if any (special case for ep).
- See Also:
com.editev.chess.Game.
applyMove
public byte applyMove(short move)
- Apply a move by index to this board.
- Parameters:
move - index of the move to apply.- Returns:
- the index of the captured piece, if any (special case for ep).
applyMoves
public void applyMoves(java.lang.String moveString)
- Apply a whole list of moves to this game.
- Parameters:
moves - slash-deliniated string listing the moves to apply to this game.
moveRandomly
public boolean moveRandomly()
- Pick a move at random from all the legal moves and apply it.
- Returns:
- true if there were any legal moves from this position.
getMoveString
public java.lang.String getMoveString()
main
public static void main(java.lang.String[] args)
- Test this class by randomly playing an awful lot of games.