Commands for inspecting opening books. More...
#include <BookCommands.hpp>
Public Member Functions | |
BookCommands (Game &game, HexEnvironment &env, boost::scoped_ptr< Book > &m_book, BookCheck &bookCheck) | |
~BookCommands () | |
void | Register (GtpEngine &engine) |
Protected Attributes | |
Game & | m_game |
HexEnvironment & | m_env |
boost::scoped_ptr< Book > & | m_book |
BookCheck & | m_bookCheck |
Private Member Functions | |
void | Register (GtpEngine &engine, const std::string &command, GtpCallback< BookCommands >::Method method) |
void | CmdBookOpen (HtpCommand &cmd) |
Opens/Creates an opening book for the current boardsize. | |
void | CmdBookClose (HtpCommand &cmd) |
Closes a book if one is open. | |
void | CmdBookStat (HtpCommand &cmd) |
void | CmdBookMainLineDepth (HtpCommand &cmd) |
void | CmdBookCounts (HtpCommand &cmd) |
void | CmdBookScores (HtpCommand &cmd) |
void | CmdBookVisualize (HtpCommand &cmd) |
void | CmdBookDumpPolarizedLeafs (HtpCommand &cmd) |
Dumps variations leading to non-terminal leafs whose value is polarized. | |
void | CmdBookImportSolvedStates (HtpCommand &cmd) |
Imports positions from file into book. | |
void | CmdBookSetValue (HtpCommand &cmd) |
Sets value of current state in the book. | |
void | CmdBookParam (HtpCommand &cmd) |
Commands for inspecting opening books.
Definition at line 21 of file BookCommands.hpp.
BookCommands::BookCommands | ( | Game & | game, | |
HexEnvironment & | env, | |||
boost::scoped_ptr< Book > & | m_book, | |||
BookCheck & | bookCheck | |||
) |
Definition at line 14 of file BookCommands.cpp.
BookCommands::~BookCommands | ( | ) |
Definition at line 24 of file BookCommands.cpp.
void BookCommands::CmdBookClose | ( | HtpCommand & | cmd | ) | [private] |
Closes a book if one is open.
Definition at line 69 of file BookCommands.cpp.
References m_book.
Referenced by Register().
void BookCommands::CmdBookCounts | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 98 of file BookCommands.cpp.
References Game::Board(), m_book, m_game, and StoneBoard::WhoseTurn().
Referenced by Register().
void BookCommands::CmdBookDumpPolarizedLeafs | ( | HtpCommand & | cmd | ) | [private] |
Dumps variations leading to non-terminal leafs whose value is polarized.
The ignore file is an optional argument that lists states that should not be ingored (not dumped again). Usage: book-dump-polarized-leafs [polarization] [output file] { [ignore file] }
Definition at line 174 of file BookCommands.cpp.
References Game::Board(), BookUtil::DumpPolarizedLeafs(), FIRST_TO_PLAY, HexPointUtil::FromString(), Game::History(), GameUtil::HistoryToSequence(), StateSet::Insert(), LogInfo(), m_book, m_game, StateSet::Size(), and StoneBoard::WhoseTurn().
Referenced by Register().
void BookCommands::CmdBookImportSolvedStates | ( | HtpCommand & | cmd | ) | [private] |
Imports positions from file into book.
Definition at line 217 of file BookCommands.cpp.
References Game::Board(), StoneBoard::Const(), BookUtil::ImportSolvedStates(), m_book, and m_game.
Referenced by Register().
void BookCommands::CmdBookMainLineDepth | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 85 of file BookCommands.cpp.
References Game::Board(), BookUtil::GetMainLineDepth(), m_book, m_game, and StoneBoard::WhoseTurn().
Referenced by Register().
void BookCommands::CmdBookOpen | ( | HtpCommand & | cmd | ) | [private] |
Opens/Creates an opening book for the current boardsize.
Usage: "book-expand [filename]"
Definition at line 56 of file BookCommands.cpp.
References m_book, and BenzeneException::what().
Referenced by Register().
void BookCommands::CmdBookParam | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 259 of file BookCommands.cpp.
References BookCheck::CountWeight(), m_bookCheck, BookCheck::MinCount(), BookCheck::SetCountWeight(), and BookCheck::SetMinCount().
Referenced by Register().
void BookCommands::CmdBookScores | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 113 of file BookCommands.cpp.
References Game::Board(), BookCheck::CountWeight(), HexEval, BookUtil::InverseEval(), HexEvalUtil::IsLoss(), HexEvalUtil::IsWin(), m_book, m_bookCheck, m_game, BookUtil::Score(), BookUtil::Value(), and StoneBoard::WhoseTurn().
Referenced by Register().
void BookCommands::CmdBookSetValue | ( | HtpCommand & | cmd | ) | [private] |
Sets value of current state in the book.
Usage: book-set-value [value] Where [value] can be one of W, L, or value in rage [0, 1].
Definition at line 235 of file BookCommands.cpp.
References Game::Board(), IMMEDIATE_LOSS, IMMEDIATE_WIN, m_book, m_game, and StoneBoard::WhoseTurn().
Referenced by Register().
void BookCommands::CmdBookStat | ( | HtpCommand & | cmd | ) | [private] |
void BookCommands::CmdBookVisualize | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 154 of file BookCommands.cpp.
References Game::Board(), BookUtil::DumpVisualizationData(), m_book, m_game, and StoneBoard::WhoseTurn().
Referenced by Register().
void BookCommands::Register | ( | GtpEngine & | engine, | |
const std::string & | command, | |||
GtpCallback< BookCommands >::Method | method | |||
) | [private] |
Definition at line 45 of file BookCommands.cpp.
void BookCommands::Register | ( | GtpEngine & | engine | ) |
Reimplemented in BookBuilderCommands< PLAYER >, and BookBuilderCommands< MoHexPlayer >.
Definition at line 28 of file BookCommands.cpp.
References CmdBookClose(), CmdBookCounts(), CmdBookDumpPolarizedLeafs(), CmdBookImportSolvedStates(), CmdBookMainLineDepth(), CmdBookOpen(), CmdBookParam(), CmdBookScores(), CmdBookSetValue(), CmdBookStat(), and CmdBookVisualize().
Referenced by WolveEngine::WolveEngine().
boost::scoped_ptr<Book>& BookCommands::m_book [protected] |
Definition at line 36 of file BookCommands.hpp.
Referenced by CmdBookClose(), CmdBookCounts(), CmdBookDumpPolarizedLeafs(), BookBuilderCommands< PLAYER >::CmdBookExpand(), CmdBookImportSolvedStates(), BookBuilderCommands< PLAYER >::CmdBookIncreaseWidth(), CmdBookMainLineDepth(), CmdBookOpen(), BookBuilderCommands< PLAYER >::CmdBookPriorities(), BookBuilderCommands< PLAYER >::CmdBookRefresh(), CmdBookScores(), CmdBookSetValue(), CmdBookStat(), and CmdBookVisualize().
BookCheck& BookCommands::m_bookCheck [protected] |
Definition at line 38 of file BookCommands.hpp.
Referenced by CmdBookParam(), and CmdBookScores().
HexEnvironment& BookCommands::m_env [protected] |
Definition at line 34 of file BookCommands.hpp.
Referenced by BookBuilderCommands< PLAYER >::CmdBookExpand(), BookBuilderCommands< PLAYER >::CmdBookIncreaseWidth(), and BookBuilderCommands< PLAYER >::CmdBookRefresh().
Game& BookCommands::m_game [protected] |
Definition at line 32 of file BookCommands.hpp.
Referenced by CmdBookCounts(), CmdBookDumpPolarizedLeafs(), BookBuilderCommands< PLAYER >::CmdBookExpand(), CmdBookImportSolvedStates(), BookBuilderCommands< PLAYER >::CmdBookIncreaseWidth(), CmdBookMainLineDepth(), BookBuilderCommands< PLAYER >::CmdBookPriorities(), BookBuilderCommands< PLAYER >::CmdBookRefresh(), CmdBookScores(), CmdBookSetValue(), and CmdBookVisualize().