|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--chesspresso.position.AbstractPosition | +--chesspresso.position.AbstractMutablePosition | +--chesspresso.position.AbstractMoveablePosition | +--chesspresso.position.Position
Field Summary | |
static int |
E
|
static int |
N
|
static int |
NE
|
static int |
NO_DIR
|
static int |
NUM_OF_DIRS
|
static int |
NW
|
static int |
S
|
static int |
SE
|
static int |
SW
|
static int |
W
|
Fields inherited from class chesspresso.position.AbstractMutablePosition |
m_changeListeners, m_listeners, m_notifyListeners, m_notifyPositionChanged |
Fields inherited from class chesspresso.position.AbstractPosition |
HASH_ALL_MASK, HASH_TOPLAY_MASK, HASH_TOPLAY_MULT, s_hashCastleMod, s_hashEPMod, s_hashMod |
Fields inherited from interface chesspresso.position.ImmutablePosition |
ALL_CASTLES, BLACK_CASTLE, BLACK_LONG_CASTLE, BLACK_SHORT_CASTLE, NO_CASTLES, WHITE_CASTLE, WHITE_LONG_CASTLE, WHITE_SHORT_CASTLE |
Constructor Summary | |
Position()
|
|
Position(ImmutablePosition pos)
|
|
Position(int bufferLength)
|
|
Position(java.lang.String fen)
|
|
Position(java.lang.String fen,
boolean strict)
|
Method Summary | |
boolean |
canMove()
|
boolean |
canRedoMove()
|
boolean |
canUndoMove()
|
void |
clear()
|
static Position |
createInitialPosition()
|
void |
doMove(short move)
|
short[] |
getAllCapturingMoves()
|
short[] |
getAllMoves()
|
short[] |
getAllNonCapturingMoves()
|
short[] |
getAllReCapturingMoves(short lastMove)
|
int |
getCastles()
Return the still allowed castles as mask. |
int |
getColor(int sqi)
|
double |
getDomination()
|
static long |
getFirstSqiBB(long bb)
|
int |
getHalfMoveClock()
Return the number of moves since the last capture and the last pawn move. |
long |
getHashCode()
Returns a 64bit hash code of the current position. 64bit should be enough to disnstinguish positions with almost no collisions. |
Move |
getLastMove()
|
short |
getLastShortMove()
|
int |
getMaterial()
|
java.lang.String |
getMovesAsString(short[] moves,
boolean validateEachMove)
|
short |
getPawnMove(int colFrom,
int to,
int promoPiece)
|
int |
getPiece(int sqi)
|
short |
getPieceMove(int piece,
int colFrom,
int rowFrom,
int to)
|
int |
getPlyNumber()
Return the current ply number. |
int |
getSqiEP()
Return the current en passant square. |
int |
getStone(int sqi)
Return the stone currently on the given square. |
int |
getToPlay()
Return the player whose turn it is. |
boolean |
isCheck()
|
boolean |
isLegal()
Return whether the current position is legal. |
boolean |
isMate()
|
boolean |
isSquareEmpty(int sqi)
|
boolean |
isStaleMate()
|
boolean |
isTerminal()
|
static long |
ofCol(int col)
|
static long |
ofRow(int row)
|
static long |
ofSquare(int sqi)
|
static void |
printProfile()
|
boolean |
redoMove()
|
void |
setCastles(int castles)
|
void |
setHalfMoveClock(int halfMoveClock)
|
void |
setPlyNumber(int plyNumber)
|
void |
setSqiEP(int sqiEP)
|
void |
setStone(int sqi,
int stone)
|
void |
setToPlay(int toPlay)
|
void |
takeBaseline()
|
void |
toggleToPlay()
|
boolean |
undoMove()
|
void |
validate()
Validates the internal state. |
Methods inherited from class chesspresso.position.AbstractMoveablePosition |
doMove, getMove |
Methods inherited from class chesspresso.position.AbstractPosition |
equals, getFEN, getStartPositionHashCode, hashCode, isCastlePossible, isSquarePossibleEPSquare, isStartPosition, isWhiteToPlay, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface chesspresso.position.MutablePosition |
set, setStart |
Methods inherited from interface chesspresso.position.ImmutablePosition |
getFEN, hashCode, isStartPosition |
Field Detail |
public static final int NO_DIR
public static final int NUM_OF_DIRS
public static final int SW
public static final int S
public static final int SE
public static final int E
public static final int NE
public static final int N
public static final int NW
public static final int W
Constructor Detail |
public Position()
public Position(int bufferLength)
public Position(ImmutablePosition pos)
public Position(java.lang.String fen) throws java.lang.IllegalArgumentException
public Position(java.lang.String fen, boolean strict) throws java.lang.IllegalArgumentException
Method Detail |
public static void printProfile()
public static final long ofSquare(int sqi)
public static final long ofCol(int col)
public static final long ofRow(int row)
public static final long getFirstSqiBB(long bb)
public static Position createInitialPosition()
public void clear()
clear
in interface MutablePosition
clear
in class AbstractMutablePosition
public final int getToPlay()
ImmutablePosition
public final boolean isSquareEmpty(int sqi)
isSquareEmpty
in class AbstractMutablePosition
public final int getCastles()
ImmutablePosition
public final int getSqiEP()
ImmutablePosition
public final int getHalfMoveClock()
ImmutablePosition
public final int getPlyNumber()
ImmutablePosition
public final long getHashCode()
ImmutablePosition
getHashCode
in interface ImmutablePosition
getHashCode
in class AbstractPosition
public final int getStone(int sqi)
ImmutablePosition
sqi
- the square
public final int getPiece(int sqi)
getPiece
in class AbstractMutablePosition
public final int getColor(int sqi)
getColor
in class AbstractMutablePosition
public final void setStone(int sqi, int stone)
public final void setPlyNumber(int plyNumber)
public void setHalfMoveClock(int halfMoveClock)
public final void setCastles(int castles)
public void setSqiEP(int sqiEP)
public final void setToPlay(int toPlay)
public final void toggleToPlay()
toggleToPlay
in class AbstractMutablePosition
public void takeBaseline()
public void doMove(short move) throws IllegalMoveException
IllegalMoveException
public boolean canUndoMove()
public boolean undoMove()
public boolean canRedoMove()
public boolean redoMove()
public boolean isLegal()
ImmutablePosition
isLegal
in interface ImmutablePosition
isLegal
in class AbstractPosition
public void validate() throws IllegalPositionException
ImmutablePosition
validate
in interface ImmutablePosition
validate
in class AbstractPosition
IllegalPositionException
- if the internal state is illegalpublic final boolean isCheck()
public boolean isTerminal()
public boolean isMate()
public boolean isStaleMate()
public short getLastShortMove()
public Move getLastMove()
public short getPawnMove(int colFrom, int to, int promoPiece)
public short getPieceMove(int piece, int colFrom, int rowFrom, int to)
public short[] getAllMoves()
public short[] getAllReCapturingMoves(short lastMove)
public short[] getAllCapturingMoves()
public short[] getAllNonCapturingMoves()
public boolean canMove()
public java.lang.String getMovesAsString(short[] moves, boolean validateEachMove)
public int getMaterial()
public double getDomination()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |