public class ZobristKeyGenerator extends Object
Modifier and Type | Method and Description |
---|---|
long |
generateHashKey(Position pos)
Generates a main Zobrist hash key for the position based on the side to move, the board state, and the castling and en passant rights.
|
long |
generatePawnKingHashKey(Position pos)
Generates a Zobrist hash key for the pawn-king structure on the board.
|
long |
generatePolyglotHashKey(Position pos)
Generates a 64 bitboard hash key used for positions in PolyGlot opening books.
|
static ZobristKeyGenerator |
getInstance() |
long |
getUpdatedBoardHashKeyAfterBlackBishopPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a bishop promotion by black.
|
long |
getUpdatedBoardHashKeyAfterBlackEnPassantMove(long key,
byte from,
byte to)
It updates a position's hash key with board state information after an en passant by black.
|
long |
getUpdatedBoardHashKeyAfterBlackKnightPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a knight promotion by black.
|
long |
getUpdatedBoardHashKeyAfterBlackLongCastlinglMove(long key)
It updates a position's hash key with board state information after a long castling by black.
|
long |
getUpdatedBoardHashKeyAfterBlackQueenPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a queen promotion by black.
|
long |
getUpdatedBoardHashKeyAfterBlackRookPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a rook promotion by black.
|
long |
getUpdatedBoardHashKeyAfterBlackShortCastlinglMove(long key)
It updates a position's hash key with board state information after a short castling by black.
|
long |
getUpdatedBoardHashKeyAfterNormalMove(long key,
byte from,
byte to,
byte movedPiece,
byte capturedPiece)
It updates a position's hash key with board state information after a normal move.
|
long |
getUpdatedBoardHashKeyAfterWhiteBishopPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a bishop promotion by white.
|
long |
getUpdatedBoardHashKeyAfterWhiteEnPassantMove(long key,
byte from,
byte to)
It updates a position's hash key with board state information after an en passant by white.
|
long |
getUpdatedBoardHashKeyAfterWhiteKnightPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a knight promotion by white.
|
long |
getUpdatedBoardHashKeyAfterWhiteLongCastlinglMove(long key)
It updates a position's hash key with board state information after a long castling by white.
|
long |
getUpdatedBoardHashKeyAfterWhiteQueenPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a queen promotion by white.
|
long |
getUpdatedBoardHashKeyAfterWhiteRookPromotionMove(long key,
byte from,
byte to,
byte capturedPiece)
It updates a position's hash key with board state information after a rook promotion by white.
|
long |
getUpdatedBoardHashKeyAfterWhiteShortCastlinglMove(long key)
It updates a position's hash key with board state information after a short castling by white.
|
long |
getUpdatedOffBoardHashKey(long key,
PositionStateRecord prevState,
byte whiteCastlingRights,
byte blackCastlingRights,
byte enPassantRights)
It updates a position's hash key with off-board state information such as the side to move, castling rights, and en passant rights.
|
public static ZobristKeyGenerator getInstance()
public long generateHashKey(Position pos)
pos
- The position to hash.public long generatePawnKingHashKey(Position pos)
pos
- The position whose pawn-king structure is to be hashed.public long generatePolyglotHashKey(Position pos)
pos
- The position whose PolyGlot hash key is to be generated.public long getUpdatedOffBoardHashKey(long key, PositionStateRecord prevState, byte whiteCastlingRights, byte blackCastlingRights, byte enPassantRights)
key
- The key to be updated.prevState
- The state record for the position's previous state.whiteCastlingRights
- The current white castling rights.blackCastlingRights
- The current black castling rights.enPassantRights
- The current en passant rights.public long getUpdatedBoardHashKeyAfterNormalMove(long key, byte from, byte to, byte movedPiece, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.movedPiece
- The moved piece.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterWhiteShortCastlinglMove(long key)
key
- The key to be updated.public long getUpdatedBoardHashKeyAfterBlackShortCastlinglMove(long key)
key
- The key to be updated.public long getUpdatedBoardHashKeyAfterWhiteLongCastlinglMove(long key)
key
- The key to be updated.public long getUpdatedBoardHashKeyAfterBlackLongCastlinglMove(long key)
key
- The key to be updated.public long getUpdatedBoardHashKeyAfterWhiteEnPassantMove(long key, byte from, byte to)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.public long getUpdatedBoardHashKeyAfterBlackEnPassantMove(long key, byte from, byte to)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.public long getUpdatedBoardHashKeyAfterWhiteQueenPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterBlackQueenPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterWhiteRookPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterBlackRookPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterWhiteBishopPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterBlackBishopPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterWhiteKnightPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.public long getUpdatedBoardHashKeyAfterBlackKnightPromotionMove(long key, byte from, byte to, byte capturedPiece)
key
- The key to be updated.from
- The origin square of the move.to
- The destination square of the move.capturedPiece
- The captured piece.Copyright © 2020. All rights reserved.