Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

CacheBook Class Reference

Uses previously-generated opening moves that have been recorded to prevent re-computing them. More...

#include <CacheBook.hpp>

List of all members.

Public Member Functions

 CacheBook ()
 Loads cached opening moves from WolveCacheBook.txt in share directory.
bool Exists (const HexState &state) const
HexPointoperator[] (const HexState &state)
std::size_t Size () const

Private Member Functions

void ParseFile (std::ifstream &inFile)
std::vector< HexPointReadPoints (std::istringstream &in) const

Private Attributes

std::map< hash_t, HexPointm_map

Detailed Description

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.


Constructor & Destructor Documentation

CacheBook::CacheBook (  ) 

Loads cached opening moves from WolveCacheBook.txt in share directory.

Definition at line 14 of file CacheBook.cpp.

References LogWarning(), and ParseFile().


Member Function Documentation

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().

HexPoint & CacheBook::operator[] ( const HexState state  )  [inline]

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]

Definition at line 49 of file CacheBook.hpp.

References m_map.

Referenced by ParseFile().


Member Data Documentation

std::map<hash_t, HexPoint> CacheBook::m_map [private]

Definition at line 33 of file CacheBook.hpp.

Referenced by Exists(), operator[](), and Size().


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


6 Jan 2011 Doxygen 1.6.3