Uses previously-generated opening moves that have been recorded to prevent re-computing them. More...
#include <CacheBook.hpp>
Public Member Functions | |
CacheBook () | |
Loads cached opening moves from WolveCacheBook.txt in share directory. | |
bool | Exists (const HexState &state) const |
HexPoint & | operator[] (const HexState &state) |
std::size_t | Size () const |
Private Member Functions | |
void | ParseFile (std::ifstream &inFile) |
std::vector< HexPoint > | ReadPoints (std::istringstream &in) const |
Private Attributes | |
std::map< hash_t, HexPoint > | m_map |
Uses previously-generated opening moves that have been recorded to prevent re-computing them.
A cache book is just a map of state hashes to HexPoints.
Not using StateMap since may not want same behaviour in rotated positions.
Definition at line 24 of file CacheBook.hpp.
CacheBook::CacheBook | ( | ) |
Loads cached opening moves from WolveCacheBook.txt in share directory.
Definition at line 14 of file CacheBook.cpp.
References LogWarning(), and ParseFile().
bool CacheBook::Exists | ( | const HexState & | state | ) | const [inline] |
Definition at line 39 of file CacheBook.hpp.
References HexState::Hash(), and m_map.
Referenced by WolveEngine::GenMove(), and ParseFile().
Definition at line 44 of file CacheBook.hpp.
References HexState::Hash(), and m_map.
Referenced by ParseFile().
void CacheBook::ParseFile | ( | std::ifstream & | inFile | ) | [private] |
Definition at line 33 of file CacheBook.cpp.
References Exists(), LogInfo(), LogWarning(), operator[](), HexState::PlayMove(), ReadPoints(), and Size().
Referenced by CacheBook().
std::vector< HexPoint > CacheBook::ReadPoints | ( | std::istringstream & | in | ) | const [private] |
Definition at line 67 of file CacheBook.cpp.
References HexPointUtil::FromString(), and INVALID_POINT.
Referenced by ParseFile().
std::size_t CacheBook::Size | ( | ) | const [inline] |
std::map<hash_t, HexPoint> CacheBook::m_map [private] |
Definition at line 33 of file CacheBook.hpp.
Referenced by Exists(), operator[](), and Size().