Commands for autobook. More...
#include <GoUctBookBuilderCommands.h>
Public Member Functions | |
GoUctBookBuilderCommands (const GoBoard &bd, GoPlayer *&player, boost::scoped_ptr< GoAutoBook > &book) | |
Constructor. | |
void | AddGoGuiAnalyzeCommands (GtpCommand &cmd) |
void | Register (GtpEngine &engine) |
Command Callbacks | |
void | CmdOpen (GtpCommand &cmd) |
Opens a autobook. | |
void | CmdClose (GtpCommand &cmd) |
Closes the current autobook. | |
void | CmdSave (GtpCommand &cmd) |
Saves the current book to its file. | |
void | CmdExpand (GtpCommand &cmd) |
Expands book from current state using the current player. | |
void | CmdCover (GtpCommand &cmd) |
Covers the given set of lines in the current book. | |
void | CmdAdditiveCover (GtpCommand &cmd) |
Covers the given set of lines in the current book. | |
void | CmdRefresh (GtpCommand &cmd) |
Refreshes the current book. | |
void | CmdMerge (GtpCommand &cmd) |
Merges the current book with the given book. | |
void | CmdParam (GtpCommand &cmd) |
void | CmdScores (GtpCommand &cmd) |
Displays scores for all children. | |
void | CmdStateInfo (GtpCommand &cmd) |
Returns info on current state. | |
void | CmdCounts (GtpCommand &cmd) |
Displays counts for all children. | |
void | CmdPriority (GtpCommand &cmd) |
Displays expansion priority for all children. | |
void | CmdLoadDisabled (GtpCommand &cmd) |
Load a list of disabled lines. | |
void | CmdTruncateByDepth (GtpCommand &cmd) |
Truncates the book to the given depth. | |
void | CmdImport (GtpCommand &cmd) |
Import values directly into the current book. | |
void | CmdExport (GtpCommand &cmd) |
Exports book to old book format. | |
void | CmdMainLine (GtpCommand &cmd) |
Displays the mainline according to the current selection type. | |
Private Member Functions | |
PLAYER & | Player () |
void | Register (GtpEngine &e, const std::string &command, typename GtpCallback< GoUctBookBuilderCommands >::Method method) |
void | ShowInfluence (GtpCommand &cmd, GoAutoBookState &state) |
GoAutoBookMoveSelectType | MoveSelectArg (const GtpCommand &cmd, std::size_t number) |
std::string | MoveSelectToString (GoAutoBookMoveSelectType moveSelect) |
Private Attributes | |
const GoBoard & | m_bd |
GoPlayer *& | m_player |
boost::scoped_ptr< GoAutoBook > & | m_book |
GoUctBookBuilder< PLAYER > | m_bookBuilder |
GoAutoBookParam | m_param |
Commands for autobook.
Definition at line 25 of file GoUctBookBuilderCommands.h.
GoUctBookBuilderCommands< PLAYER >::GoUctBookBuilderCommands | ( | const GoBoard & | bd, | |
GoPlayer *& | player, | |||
boost::scoped_ptr< GoAutoBook > & | book | |||
) |
Constructor.
bd | The game board. | |
player | Reference to pointer to current player, this player can be null or a different player, but those commands of this class that need a GoUctPlayer will fail, if the current player is not a PLAYER. | |
book |
Definition at line 111 of file GoUctBookBuilderCommands.h.
void GoUctBookBuilderCommands< PLAYER >::AddGoGuiAnalyzeCommands | ( | GtpCommand & | cmd | ) |
Definition at line 122 of file GoUctBookBuilderCommands.h.
void GoUctBookBuilderCommands< PLAYER >::CmdAdditiveCover | ( | GtpCommand & | cmd | ) |
Covers the given set of lines in the current book.
See Book Cover in Automatic Opening Book Construction
Definition at line 345 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GtpCommand::ArgMin(), GtpCommand::CheckNuArg(), GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, GoAutoBook::ParseWorkList(), and GoUctBookBuilderCommands< PLAYER >::Player().
void GoUctBookBuilderCommands< PLAYER >::CmdClose | ( | GtpCommand & | cmd | ) |
Closes the current autobook.
Definition at line 274 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), and GoUctBookBuilderCommands< PLAYER >::m_book.
void GoUctBookBuilderCommands< PLAYER >::CmdCounts | ( | GtpCommand & | cmd | ) |
Displays counts for all children.
Definition at line 549 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), GoBoard::IsLegal(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, SgBookNode::m_count, GoAutoBookState::Play(), GoUctBookBuilderCommands< PLAYER >::ShowInfluence(), GoAutoBookState::Synchronize(), and GoAutoBookState::Undo().
void GoUctBookBuilderCommands< PLAYER >::CmdCover | ( | GtpCommand & | cmd | ) |
Covers the given set of lines in the current book.
See Book Cover in Automatic Opening Book Construction
Definition at line 321 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GtpCommand::ArgMin(), GtpCommand::CheckNuArg(), GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, GoAutoBook::ParseWorkList(), and GoUctBookBuilderCommands< PLAYER >::Player().
void GoUctBookBuilderCommands< PLAYER >::CmdExpand | ( | GtpCommand & | cmd | ) |
Expands book from current state using the current player.
Definition at line 307 of file GoUctBookBuilderCommands.h.
References GtpCommand::ArgMin(), GtpCommand::CheckNuArg(), GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, and GoUctBookBuilderCommands< PLAYER >::Player().
void GoUctBookBuilderCommands< PLAYER >::CmdExport | ( | GtpCommand & | cmd | ) |
Exports book to old book format.
Definition at line 406 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, and GoAutoBookState::Synchronize().
void GoUctBookBuilderCommands< PLAYER >::CmdImport | ( | GtpCommand & | cmd | ) |
Import values directly into the current book.
File format is (hash, value) pairs, one per line.
Definition at line 393 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), and GoUctBookBuilderCommands< PLAYER >::m_book.
void GoUctBookBuilderCommands< PLAYER >::CmdLoadDisabled | ( | GtpCommand & | cmd | ) |
Load a list of disabled lines.
See GoAutoBook::AddDisabledLines().
Definition at line 490 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, GoAutoBook::ParseWorkList(), and GoBoard::Size().
void GoUctBookBuilderCommands< PLAYER >::CmdMainLine | ( | GtpCommand & | cmd | ) |
Displays the mainline according to the current selection type.
Definition at line 607 of file GoUctBookBuilderCommands.h.
References GoAutoBookState::Board(), GtpCommand::CheckArgNone(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, GoAutoBookState::Play(), SG_BLACK, SG_NULLMOVE, GoAutoBookState::Synchronize(), and GoBoard::ToPlay().
void GoUctBookBuilderCommands< PLAYER >::CmdMerge | ( | GtpCommand & | cmd | ) |
Merges the current book with the given book.
See GoAutoBook::Merge().
Definition at line 382 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GoUctBookBuilderCommands< PLAYER >::m_book, and GoUctBookBuilderCommands< PLAYER >::m_param.
void GoUctBookBuilderCommands< PLAYER >::CmdOpen | ( | GtpCommand & | cmd | ) |
Opens a autobook.
Closes any previously opened book.
Definition at line 267 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GoUctBookBuilderCommands< PLAYER >::m_book, and GoUctBookBuilderCommands< PLAYER >::m_param.
void GoUctBookBuilderCommands< PLAYER >::CmdParam | ( | GtpCommand & | cmd | ) |
Definition at line 436 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GtpCommand::ArgMin(), GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, GoUctBookBuilderCommands< PLAYER >::m_param, GoAutoBookParam::m_selectType, GoAutoBookParam::m_usageCountThreshold, GoUctBookBuilderCommands< PLAYER >::MoveSelectArg(), GoUctBookBuilderCommands< PLAYER >::MoveSelectToString(), and GtpCommand::NuArg().
void GoUctBookBuilderCommands< PLAYER >::CmdPriority | ( | GtpCommand & | cmd | ) |
Displays expansion priority for all children.
Definition at line 574 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), GoBoard::IsLegal(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, SgBookNode::m_priority, SgBookNode::m_value, GoAutoBookState::Play(), GoUctBookBuilderCommands< PLAYER >::ShowInfluence(), GoAutoBookState::Synchronize(), and GoAutoBookState::Undo().
void GoUctBookBuilderCommands< PLAYER >::CmdRefresh | ( | GtpCommand & | cmd | ) |
Refreshes the current book.
See Book Refresh in Automatic Opening Book Construction
Definition at line 369 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, and GoUctBookBuilderCommands< PLAYER >::Player().
void GoUctBookBuilderCommands< PLAYER >::CmdSave | ( | GtpCommand & | cmd | ) |
Saves the current book to its file.
Definition at line 282 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), and GoUctBookBuilderCommands< PLAYER >::m_book.
void GoUctBookBuilderCommands< PLAYER >::CmdScores | ( | GtpCommand & | cmd | ) |
Displays scores for all children.
Definition at line 519 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), GoBoard::IsLegal(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, GoAutoBookState::Play(), GoUctBookBuilderCommands< PLAYER >::ShowInfluence(), GoAutoBookState::Synchronize(), and GoAutoBookState::Undo().
void GoUctBookBuilderCommands< PLAYER >::CmdStateInfo | ( | GtpCommand & | cmd | ) |
Returns info on current state.
Definition at line 292 of file GoUctBookBuilderCommands.h.
References GtpCommand::CheckArgNone(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, and GoAutoBookState::Synchronize().
void GoUctBookBuilderCommands< PLAYER >::CmdTruncateByDepth | ( | GtpCommand & | cmd | ) |
Truncates the book to the given depth.
Internal nodes that become leaves have their counts set to 0.
Definition at line 422 of file GoUctBookBuilderCommands.h.
References GtpCommand::Arg(), GtpCommand::ArgMin(), GtpCommand::CheckNuArg(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, and GoUctBookBuilderCommands< PLAYER >::m_param.
GoAutoBookMoveSelectType GoUctBookBuilderCommands< PLAYER >::MoveSelectArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | [private] |
Definition at line 209 of file GoUctBookBuilderCommands.h.
References GtpCommand::ArgToLower(), GO_AUTOBOOK_SELECT_COUNT, and GO_AUTOBOOK_SELECT_VALUE.
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdParam().
std::string GoUctBookBuilderCommands< PLAYER >::MoveSelectToString | ( | GoAutoBookMoveSelectType | moveSelect | ) | [private] |
Definition at line 221 of file GoUctBookBuilderCommands.h.
References GO_AUTOBOOK_SELECT_COUNT, GO_AUTOBOOK_SELECT_VALUE, and SG_ASSERT.
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdParam().
PLAYER & GoUctBookBuilderCommands< PLAYER >::Player | ( | ) | [private] |
Definition at line 193 of file GoUctBookBuilderCommands.h.
References GoUctBookBuilderCommands< PLAYER >::m_player.
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdAdditiveCover(), GoUctBookBuilderCommands< PLAYER >::CmdCover(), GoUctBookBuilderCommands< PLAYER >::CmdExpand(), and GoUctBookBuilderCommands< PLAYER >::CmdRefresh().
void GoUctBookBuilderCommands< PLAYER >::Register | ( | GtpEngine & | e, | |
const std::string & | command, | |||
typename GtpCallback< GoUctBookBuilderCommands< PLAYER > >::Method | method | |||
) | [private] |
Definition at line 185 of file GoUctBookBuilderCommands.h.
References GtpEngine::Register().
void GoUctBookBuilderCommands< PLAYER >::Register | ( | GtpEngine & | engine | ) |
Definition at line 146 of file GoUctBookBuilderCommands.h.
void GoUctBookBuilderCommands< PLAYER >::ShowInfluence | ( | GtpCommand & | cmd, | |
GoAutoBookState & | state | |||
) | [private] |
Definition at line 238 of file GoUctBookBuilderCommands.h.
References GoBoard::IsLegal(), GoUctBookBuilderCommands< PLAYER >::m_bd, GoUctBookBuilderCommands< PLAYER >::m_book, GoUctBookBuilderCommands< PLAYER >::m_bookBuilder, GoAutoBookState::Play(), SG_BLACK, GoBoard::ToPlay(), and GoAutoBookState::Undo().
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdCounts(), GoUctBookBuilderCommands< PLAYER >::CmdPriority(), and GoUctBookBuilderCommands< PLAYER >::CmdScores().
const GoBoard& GoUctBookBuilderCommands< PLAYER >::m_bd [private] |
Definition at line 84 of file GoUctBookBuilderCommands.h.
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdCounts(), GoUctBookBuilderCommands< PLAYER >::CmdExport(), GoUctBookBuilderCommands< PLAYER >::CmdLoadDisabled(), GoUctBookBuilderCommands< PLAYER >::CmdMainLine(), GoUctBookBuilderCommands< PLAYER >::CmdPriority(), GoUctBookBuilderCommands< PLAYER >::CmdScores(), GoUctBookBuilderCommands< PLAYER >::CmdStateInfo(), GoUctBookBuilderCommands< PLAYER >::CmdTruncateByDepth(), and GoUctBookBuilderCommands< PLAYER >::ShowInfluence().
boost::scoped_ptr<GoAutoBook>& GoUctBookBuilderCommands< PLAYER >::m_book [private] |
Definition at line 88 of file GoUctBookBuilderCommands.h.
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdAdditiveCover(), GoUctBookBuilderCommands< PLAYER >::CmdClose(), GoUctBookBuilderCommands< PLAYER >::CmdCounts(), GoUctBookBuilderCommands< PLAYER >::CmdCover(), GoUctBookBuilderCommands< PLAYER >::CmdExpand(), GoUctBookBuilderCommands< PLAYER >::CmdExport(), GoUctBookBuilderCommands< PLAYER >::CmdImport(), GoUctBookBuilderCommands< PLAYER >::CmdLoadDisabled(), GoUctBookBuilderCommands< PLAYER >::CmdMainLine(), GoUctBookBuilderCommands< PLAYER >::CmdMerge(), GoUctBookBuilderCommands< PLAYER >::CmdOpen(), GoUctBookBuilderCommands< PLAYER >::CmdPriority(), GoUctBookBuilderCommands< PLAYER >::CmdRefresh(), GoUctBookBuilderCommands< PLAYER >::CmdSave(), GoUctBookBuilderCommands< PLAYER >::CmdScores(), GoUctBookBuilderCommands< PLAYER >::CmdStateInfo(), GoUctBookBuilderCommands< PLAYER >::CmdTruncateByDepth(), and GoUctBookBuilderCommands< PLAYER >::ShowInfluence().
GoUctBookBuilder<PLAYER> GoUctBookBuilderCommands< PLAYER >::m_bookBuilder [private] |
Definition at line 90 of file GoUctBookBuilderCommands.h.
Referenced by GoUctBookBuilderCommands< PLAYER >::CmdAdditiveCover(), GoUctBookBuilderCommands< PLAYER >::CmdCover(), GoUctBookBuilderCommands< PLAYER >::CmdExpand(), GoUctBookBuilderCommands< PLAYER >::CmdParam(), GoUctBookBuilderCommands< PLAYER >::CmdPriority(), GoUctBookBuilderCommands< PLAYER >::CmdRefresh(), GoUctBookBuilderCommands< PLAYER >::CmdScores(), and GoUctBookBuilderCommands< PLAYER >::ShowInfluence().
GoAutoBookParam GoUctBookBuilderCommands< PLAYER >::m_param [private] |
GoPlayer*& GoUctBookBuilderCommands< PLAYER >::m_player [private] |
Definition at line 86 of file GoUctBookBuilderCommands.h.
Referenced by GoUctBookBuilderCommands< PLAYER >::Player().