Xiangiqgame
AI engine for Xiangqi
|
Uses Zobrist hashing to calculate a "reasonably unique" integer value for each board configuration encountered during a game. More...
#include <zobrist.hpp>
Public Member Functions | |
ZobristCalculator (uint32_t seed=std::random_device{}()) | |
Constructs a ZobristCalculator. | |
KeyType | board_state () const |
GameZarray_t | zarray () const |
KeyType | turn_key () const |
uint32_t | seed () const |
void | FullBoardStateCalc (const gameboard::BoardMap_t &board_map) |
void | UpdateBoardState (const gameboard::ExecutedMove &executed_move) |
KeyType | GetHashValueAt (PieceColor color, PieceType piece_type, BoardSpace space) |
Private Types | |
using | PieceZarray_t = array< array< KeyType, gameboard::kNumFiles >, gameboard::kNumRanks > |
using | TeamZarray_t = array< PieceZarray_t, gameboard::kNumPieceTypeVals > |
using | GameZarray_t = array< TeamZarray_t, 2 > |
Private Member Functions | |
void | FullBoardStateCalInternal (const gameboard::BoardMap_t &board_map) |
void | UpdateBoardStateInternal (const gameboard::ExecutedMove &executed_move) |
Static Private Member Functions | |
static const GameZarray_t | CreateGameZarray (PseudoRandomKeyGenerator< KeyType > &key_generator) |
Static helper method for building 4-D array of Zobrist keys in constuctor. | |
Private Attributes | |
GameZarray_t | zarray_ |
KeyType | turn_key_ |
uint32_t | seed_ |
KeyType | board_state_ |
Uses Zobrist hashing to calculate a "reasonably unique" integer value for each board configuration encountered during a game.
KeyType can be any unsigned integer type with a size = (n * 32 bits) where n is an integer >= 1.
Definition at line 30 of file zobrist.hpp.
|
private |
Definition at line 35 of file zobrist.hpp.
|
private |
Definition at line 32 of file zobrist.hpp.
|
private |
Definition at line 34 of file zobrist.hpp.
|
inline |
Constructs a ZobristCalculator.
seed | Integer used as a seed for a PRNG that generates Zobrist key values. |
Definition at line 45 of file zobrist.hpp.
|
inline |
Definition at line 56 of file zobrist.hpp.
|
inlinestaticprivate |
Static helper method for building 4-D array of Zobrist keys in constuctor.
Definition at line 77 of file zobrist.hpp.
|
inline |
Definition at line 63 of file zobrist.hpp.
|
inlineprivate |
Definition at line 95 of file zobrist.hpp.
|
inline |
Definition at line 71 of file zobrist.hpp.
|
inline |
Definition at line 59 of file zobrist.hpp.
|
inline |
Definition at line 58 of file zobrist.hpp.
|
inline |
Definition at line 67 of file zobrist.hpp.
|
inlineprivate |
Definition at line 110 of file zobrist.hpp.
|
inline |
Definition at line 57 of file zobrist.hpp.
|
private |
Definition at line 40 of file zobrist.hpp.
|
private |
Definition at line 39 of file zobrist.hpp.
|
private |
Definition at line 38 of file zobrist.hpp.
|
private |
Definition at line 37 of file zobrist.hpp.