Xiangiqgame
AI engine for Xiangqi
Loading...
Searching...
No Matches
boardstate::ZobristComponent< KeyType, NumConfKeys > Class Template Reference

Container for one or more boardstate::ZobristCalculator objects. More...

#include <zobrist.hpp>

Collaboration diagram for boardstate::ZobristComponent< KeyType, NumConfKeys >:
Collaboration graph

Public Member Functions

 ZobristComponent (const ZobristCalculator< KeyType > primary_calculator, const std::array< ZobristCalculator< KeyType >, NumConfKeys > &confirmation_calculators)
 Constructs ZobristComponent from existing ZobristCalculator objects.
 
 ZobristComponent (uint32_t prng_seed=std::random_device{}())
 Constructs ZobristComponent using 32-bit unsigned in as a PRNG seed.
 
KeyType primary_board_state ()
 
std::array< KeyType, NumConfKeys > confirmation_board_states ()
 
KeyType primary_calculator_seed ()
 
std::array< uint32_t, NumConfKeys > confirmation_calculator_seeds () const
 
std::string primary_board_state_hex_str () const
 
uint32_t prng_seed ()
 
void UpdateBoardStates (const ExecutedMove &executed_move)
 
void FullBoardStateCalc (const BoardMap_t &board_map)
 

Private Member Functions

 ZobristComponent (std::mt19937 prng)
 Constructs ZobristComponent from a std::mt19937 pseudorandom number generator.
 
std::array< KeyType, NumConfKeys > confirmation_board_states_internal ()
 
std::array< uint32_t, NumConfKeys > confirmation_calculator_seeds_internal () const
 
void UpdateBoardStatesInternal (const ExecutedMove &executed_move)
 
void FullBoardStateCalcInternal (const BoardMap_t &board_map)
 

Private Attributes

ZobristCalculator< KeyType > primary_calculator_
 
std::array< ZobristCalculator< KeyType >, NumConfKeys > confirmation_calculators_
 
std::optional< uint32_t > prng_seed_
 

Detailed Description

template<typename KeyType, size_t NumConfKeys>
class boardstate::ZobristComponent< KeyType, NumConfKeys >

Container for one or more boardstate::ZobristCalculator objects.

Using more than one boardstate::ZobristCalculator (i.e. NumConfKeys > 0) allows hash collisions to be detected.

Definition at line 142 of file zobrist.hpp.

Constructor & Destructor Documentation

◆ ZobristComponent() [1/3]

template<typename KeyType , size_t NumConfKeys>
boardstate::ZobristComponent< KeyType, NumConfKeys >::ZobristComponent ( const ZobristCalculator< KeyType >  primary_calculator,
const std::array< ZobristCalculator< KeyType >, NumConfKeys > &  confirmation_calculators 
)
inlineexplicit

Constructs ZobristComponent from existing ZobristCalculator objects.

Definition at line 150 of file zobrist.hpp.

◆ ZobristComponent() [2/3]

template<typename KeyType , size_t NumConfKeys>
boardstate::ZobristComponent< KeyType, NumConfKeys >::ZobristComponent ( uint32_t  prng_seed = std::random_device{}())
inlineexplicit

Constructs ZobristComponent using 32-bit unsigned in as a PRNG seed.

Definition at line 158 of file zobrist.hpp.

◆ ZobristComponent() [3/3]

template<typename KeyType , size_t NumConfKeys>
boardstate::ZobristComponent< KeyType, NumConfKeys >::ZobristComponent ( std::mt19937  prng)
inlineexplicitprivate

Constructs ZobristComponent from a std::mt19937 pseudorandom number generator.

Used as a helper to public constructor (via delegation).

Definition at line 189 of file zobrist.hpp.

Member Function Documentation

◆ confirmation_board_states()

template<typename KeyType , size_t NumConfKeys>
std::array< KeyType, NumConfKeys > boardstate::ZobristComponent< KeyType, NumConfKeys >::confirmation_board_states ( )
inline

Definition at line 165 of file zobrist.hpp.

◆ confirmation_board_states_internal()

template<typename KeyType , size_t NumConfKeys>
std::array< KeyType, NumConfKeys > boardstate::ZobristComponent< KeyType, NumConfKeys >::confirmation_board_states_internal ( )
inlineprivate

Definition at line 198 of file zobrist.hpp.

◆ confirmation_calculator_seeds()

template<typename KeyType , size_t NumConfKeys>
std::array< uint32_t, NumConfKeys > boardstate::ZobristComponent< KeyType, NumConfKeys >::confirmation_calculator_seeds ( ) const
inline

Definition at line 169 of file zobrist.hpp.

◆ confirmation_calculator_seeds_internal()

template<typename KeyType , size_t NumConfKeys>
std::array< uint32_t, NumConfKeys > boardstate::ZobristComponent< KeyType, NumConfKeys >::confirmation_calculator_seeds_internal ( ) const
inlineprivate

Definition at line 206 of file zobrist.hpp.

◆ FullBoardStateCalc()

template<typename KeyType , size_t NumConfKeys>
void boardstate::ZobristComponent< KeyType, NumConfKeys >::FullBoardStateCalc ( const BoardMap_t board_map)
inline

Definition at line 182 of file zobrist.hpp.

◆ FullBoardStateCalcInternal()

template<typename KeyType , size_t NumConfKeys>
void boardstate::ZobristComponent< KeyType, NumConfKeys >::FullBoardStateCalcInternal ( const BoardMap_t board_map)
inlineprivate

Definition at line 221 of file zobrist.hpp.

◆ primary_board_state()

template<typename KeyType , size_t NumConfKeys>
KeyType boardstate::ZobristComponent< KeyType, NumConfKeys >::primary_board_state ( )
inline

Definition at line 164 of file zobrist.hpp.

◆ primary_board_state_hex_str()

template<typename KeyType , size_t NumConfKeys>
std::string boardstate::ZobristComponent< KeyType, NumConfKeys >::primary_board_state_hex_str ( ) const
inline

Definition at line 172 of file zobrist.hpp.

◆ primary_calculator_seed()

template<typename KeyType , size_t NumConfKeys>
KeyType boardstate::ZobristComponent< KeyType, NumConfKeys >::primary_calculator_seed ( )
inline

Definition at line 168 of file zobrist.hpp.

◆ prng_seed()

template<typename KeyType , size_t NumConfKeys>
uint32_t boardstate::ZobristComponent< KeyType, NumConfKeys >::prng_seed ( )
inline

Definition at line 175 of file zobrist.hpp.

◆ UpdateBoardStates()

template<typename KeyType , size_t NumConfKeys>
void boardstate::ZobristComponent< KeyType, NumConfKeys >::UpdateBoardStates ( const ExecutedMove executed_move)
inline

Definition at line 178 of file zobrist.hpp.

◆ UpdateBoardStatesInternal()

template<typename KeyType , size_t NumConfKeys>
void boardstate::ZobristComponent< KeyType, NumConfKeys >::UpdateBoardStatesInternal ( const ExecutedMove executed_move)
inlineprivate

Definition at line 214 of file zobrist.hpp.

Member Data Documentation

◆ confirmation_calculators_

template<typename KeyType , size_t NumConfKeys>
std::array<ZobristCalculator<KeyType>, NumConfKeys> boardstate::ZobristComponent< KeyType, NumConfKeys >::confirmation_calculators_
private

Definition at line 145 of file zobrist.hpp.

◆ primary_calculator_

template<typename KeyType , size_t NumConfKeys>
ZobristCalculator<KeyType> boardstate::ZobristComponent< KeyType, NumConfKeys >::primary_calculator_
private

Definition at line 144 of file zobrist.hpp.

◆ prng_seed_

template<typename KeyType , size_t NumConfKeys>
std::optional<uint32_t> boardstate::ZobristComponent< KeyType, NumConfKeys >::prng_seed_
private

Definition at line 146 of file zobrist.hpp.


The documentation for this class was generated from the following file: