Unsigned 64-bit values for generating zobrist position keys.
More...
#include <zobrist.h>
Unsigned 64-bit values for generating zobrist position keys.
Chess::Board uses zobrist keys to quickly and easily compare two positions for equality. Primary uses for zobrist keys are:
- Detecting repetitions, ie. a draw by three-fold repetition
- Opening books
- In hash table entries
| Chess::Zobrist::Zobrist |
( |
const quint64 * |
keys = nullptr | ) |
|
Creates a new uninitialized Zobrist object.
- Parameters
-
| keys | An array of zobrist keys that can be used instead of the random numbers generated by the Zobrist class. |
| virtual Chess::Zobrist::~Zobrist |
( |
| ) |
|
|
inlinevirtual |
| void Chess::Zobrist::initialize |
( |
int |
squareCount, |
|
|
int |
pieceTypeCount |
|
) |
| |
|
virtual |
Initializes the zobrist numbers.
- Parameters
-
| squareCount | The number of squares the board has, including the invisible "Wall" squares. |
| pieceTypeCount | The number of piece types the variant has, including the empty "NoPiece" type (type 0). |
- Note
- Subclasses that reimplement this function must call the base implementation.
Reimplemented in Chess::WesternZobrist.
| bool Chess::Zobrist::isInitialized |
( |
| ) |
const |
Returns true if the keys are initialized.
| const quint64 * Chess::Zobrist::keys |
( |
| ) |
const |
|
inlineprotected |
Returns the array of zobrist keys.
| quint64 Chess::Zobrist::piece |
( |
const Piece & |
piece, |
|
|
int |
square |
|
) |
| const |
|
virtual |
| int Chess::Zobrist::pieceTypeCount |
( |
| ) |
const |
|
inlineprotected |
Returns the number of piece types the variant has, including the empty "NoPiece" type (type 0).
| quint64 Chess::Zobrist::random64 |
( |
| ) |
|
|
staticprotected |
Returns an unsigned 64-bit pseudo-random number.
| quint64 Chess::Zobrist::reservePiece |
( |
const Piece & |
piece, |
|
|
int |
slot |
|
) |
| const |
|
virtual |
Returns the zobrist value for reserve piece piece at slot.
- Note
- slot is zero-based, so the first piece of type piece is at slot 0.
| quint64 Chess::Zobrist::side |
( |
| ) |
const |
|
virtual |
Returns the zobrist value for side to move. This value must be in the key on black's turn.
Reimplemented in Chess::WesternZobrist.
| int Chess::Zobrist::squareCount |
( |
| ) |
const |
|
inlineprotected |
Returns the number of squares the board has, including the invisible "Wall" squares.
The documentation for this class was generated from the following files:
- projects/lib/src/board/zobrist.h
- projects/lib/src/board/zobrist.cpp