Interface ImmutablePosition
- All Known Subinterfaces:
MoveablePosition, MutablePosition
- All Known Implementing Classes:
AbstractMoveablePosition, AbstractMutablePosition, AbstractPosition, CompactPosition, LightWeightPosition, Position
public interface ImmutablePosition
- Version:
- $Revision: 1.1 $
- Author:
- Bernhard Seybold
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionintReturn the still allowed castles as mask.getFEN()Return the FEN representation of the current positionFENintReturn the number of moves since the last capture and the last pawn move.longReturns a 64bit hash code of the current position. 64bit should be enough to disnstinguish positions with almost no collisions.intReturn the current ply number.intgetSqiEP()Return the current en passant square.intgetStone(int sqi) Return the stone currently on the given square.intReturn the player whose turn it is.inthashCode()Returns a 32bit hash code of the current position. 32 bit is not enough to distinguish positions reliably, use only if collisions are handled.booleanisLegal()Return whether the current position is legal.booleanReturns whether the represented position is the startpositionvoidvalidate()Validates the internal state.
-
Field Details
-
NO_CASTLES
static final int NO_CASTLES- See Also:
-
WHITE_LONG_CASTLE
static final int WHITE_LONG_CASTLE- See Also:
-
WHITE_SHORT_CASTLE
static final int WHITE_SHORT_CASTLE- See Also:
-
BLACK_LONG_CASTLE
static final int BLACK_LONG_CASTLE- See Also:
-
BLACK_SHORT_CASTLE
static final int BLACK_SHORT_CASTLE- See Also:
-
WHITE_CASTLE
static final int WHITE_CASTLE- See Also:
-
BLACK_CASTLE
static final int BLACK_CASTLE- See Also:
-
ALL_CASTLES
static final int ALL_CASTLES- See Also:
-
-
Method Details
-
getStone
int getStone(int sqi) Return the stone currently on the given square.- Parameters:
sqi- the square- Returns:
- the stone of the given square
-
getSqiEP
int getSqiEP()Return the current en passant square.- Returns:
- the current en passant square, NO_SQUARE if none
-
getCastles
int getCastles()Return the still allowed castles as mask.- Returns:
- the still allowed castles as mask.
-
getToPlay
int getToPlay()Return the player whose turn it is.- Returns:
- the player whose turn it is
-
getPlyNumber
int getPlyNumber()Return the current ply number.- Returns:
- the current ply number, starting at play no. 0
-
getHalfMoveClock
int getHalfMoveClock()Return the number of moves since the last capture and the last pawn move. This number is used for the 50-move rule.- Returns:
- the number of moves since the last capture and the last pawn move
-
isLegal
boolean isLegal()Return whether the current position is legal.- Returns:
- whether the current position is legal
-
getFEN
-
isStartPosition
boolean isStartPosition()Returns whether the represented position is the startposition- Returns:
- whether the represented position is the startposition
-
getHashCode
long getHashCode()Returns a 64bit hash code of the current position. 64bit should be enough to disnstinguish positions with almost no collisions. TODO: add reference to paper- Returns:
- a 64bit hash code
-
hashCode
-
validate
Validates the internal state. Used for debugging and testing.- Throws:
IllegalPositionException- if the internal state is illegal
-