#include <GoGtpEngine.h>
Inheritance diagram for GoGtpEngine:
Definition at line 29 of file GoGtpEngine.h.
Public Member Functions | |
GoGtpEngine (GtpInputStream &in, GtpOutputStream &out, int fixedBoardSize, const char *programPath=0, bool noPlayer=false, bool noHandicap=false) | |
Constructor. | |
~GoGtpEngine () | |
GoBook & | Book () |
void | DumpState (std::ostream &out) const |
Write game and player boards. | |
void | SetAutoSave (const std::string &prefix) |
Automatically save game after each move. | |
void | SetStatisticsFile (const std::string &fileName) |
File to save statistics. | |
void | SetAutoShowBoard (bool showBoard) |
Automatically write board to SgDebug() after changes. | |
void | SetDebugToComment (bool debugToComment) |
Write everything written to SgDebug() during a genmove command to the comment in the new game node. | |
void | SetMaxClearBoard (int n) |
Set maximum number of clear_board commands. | |
void | SetNamedRules (const std::string &namedRules) |
Set named rules. | |
void | SetTimeLimit (double timeLimit) |
See TimeLimit(). | |
double | TimeLimit () |
Time limit in seconds for move generation and other commands. | |
void | SetMpiSynchronizer (const SgMpiSynchronizerHandle &m_handle) |
SgMpiSynchronizerHandle | MpiSynchronizer () |
const SgMpiSynchronizerHandle | MpiSynchronizer () const |
void | ExecuteFile (const std::string &name, std::ostream &log=std::cerr) |
std::string | ExecuteCommand (const std::string &cmd, std::ostream &log=std::cerr) |
void | MainLoop () |
void | Register (const std::string &name, GtpCallbackBase *callback) |
void | Register (const std::string &command, typename GtpCallback< T >::Method method, T *instance) |
bool | IsRegistered (const std::string &command) const |
void | SetQuit () |
bool | IsQuitSet () const |
virtual void | Ponder () |
virtual void | InitPonder () |
virtual void | StopPonder () |
virtual void | Interrupt () |
virtual void | CmdKnownCommand (GtpCommand &) |
virtual void | CmdListCommands (GtpCommand &) |
virtual void | CmdProtocolVersion (GtpCommand &) |
virtual void | CmdVersion (GtpCommand &) |
Command Callbacks | |
virtual void | CmdAllLegal (GtpCommand &) |
Return all legal move points. | |
virtual void | CmdAllMoveValues (GtpCommand &) |
Like GNU Go's all_move_values. | |
virtual void | CmdAnalyzeCommands (GtpCommand &) |
Return configuration for GoGui analyze commands. | |
virtual void | CmdBoard (GtpCommand &) |
Print some information about game board. | |
virtual void | CmdBoardSize (GtpCommand &) |
Init new game with given board size. | |
virtual void | CmdClearBoard (GtpCommand &) |
Init new game. | |
virtual void | CmdClock (GtpCommand &) |
Show clock info from GoGameRecord::Time(). | |
virtual void | CmdFinalScore (GtpCommand &) |
Compute final score. | |
virtual void | CmdFixedHandicap (GtpCommand &) |
Standard GTP command fixed_handicap. | |
virtual void | CmdGenMove (GtpCommand &) |
Generate and play a move. | |
virtual void | CmdGenMoveCleanup (GtpCommand &) |
Generate cleanup move. | |
virtual void | CmdGetKomi (GtpCommand &) |
Get the komi. | |
virtual void | CmdGGUndo (GtpCommand &) |
Undo multiple moves. | |
virtual void | CmdInterrupt (GtpCommand &) |
This command indicates that commands can be interrupted using the GoGui convention. | |
virtual void | CmdIsLegal (GtpCommand &) |
Check if move is legal. | |
virtual void | CmdKgsTimeSettings (GtpCommand &cmd) |
Sets time settings on kgs. | |
virtual void | CmdKomi (GtpCommand &) |
Set the komi. | |
virtual void | CmdListStones (GtpCommand &) |
List stones on board. | |
virtual void | CmdLoadSgf (GtpCommand &) |
Load a position from a SGF file. | |
virtual void | CmdName (GtpCommand &) |
Return name of player, if set, GtpEngine::Name otherwise. | |
virtual void | CmdParam (GtpCommand &) |
Get and set GoGtpEngine parameters. | |
virtual void | CmdParamRules (GtpCommand &) |
Get and set detailed rule parameters. | |
virtual void | CmdParamTimecontrol (GtpCommand &) |
Get and set time control parameters. | |
virtual void | CmdPlaceFreeHandicap (GtpCommand &) |
Standard GTP command place_free_handicap. | |
virtual void | CmdPlay (GtpCommand &) |
Play a move. | |
virtual void | CmdPlayerBoard (GtpCommand &) |
Print some information about player board. | |
virtual void | CmdPlaySequence (GtpCommand &) |
Play a sequence of moves. | |
virtual void | CmdPointNumbers (GtpCommand &) |
Show point numbers used in GoBoard. | |
virtual void | CmdPointInfo (GtpCommand &) |
Print some information about point. | |
virtual void | CmdQuit (GtpCommand &cmd) |
virtual void | CmdRegGenMove (GtpCommand &) |
Generate a move, but do not play it. | |
virtual void | CmdRegGenMoveToPlay (GtpCommand &) |
Version of CmdRegGenMove() without color argument. | |
virtual void | CmdRules (GtpCommand &) |
Set named rules. | |
virtual void | CmdSaveSgf (GtpCommand &) |
Save current game to file. | |
virtual void | CmdSentinelFile (GtpCommand &) |
Define a file that makes future clear_board commands fail. | |
virtual void | CmdSetFreeHandicap (GtpCommand &) |
Standard GTP command for explicit placement of handicap stones. | |
virtual void | CmdSetInfo (GtpCommand &) |
Set game info property in root node of internal SGF tree. | |
virtual void | CmdSetup (GtpCommand &) |
Place setup stones. | |
virtual void | CmdSetupPlayer (GtpCommand &) |
Set color to play. | |
virtual void | CmdShowBoard (GtpCommand &) |
Show current position. | |
virtual void | CmdTimeLastMove (GtpCommand &) |
Time of last ganmove command. | |
virtual void | CmdTimeLeft (GtpCommand &) |
Standard GTP command. | |
virtual void | CmdTimeSettings (GtpCommand &) |
Standard GTP command. | |
virtual void | CmdUndo (GtpCommand &) |
Undo a move. | |
Protected Member Functions | |
void | BeforeHandleCommand () |
Hook function to be executed before each command. | |
void | BeforeWritingResponse () |
Hook function to be executed before the response of a command is written. | |
GoBoard & | Board () |
const GoBoard & | Board () const |
void | BoardChanged () |
void | CheckLegal (std::string message, SgBlackWhite color, SgPoint move, bool checkOnlyOccupied) |
Check if move is legal. | |
void | CheckMaxClearBoard () |
void | CheckMoveStackOverflow () const |
SgPoint | GenMove (SgBlackWhite color, bool ignoreClock) |
GoGame & | GetGame () |
const GoGame & | GetGame () const |
GoPlayer & | Player () const |
Throws GtpFailure if no player set. | |
void | RespondNumberArray (GtpCommand &cmd, const SgPointArray< int > &array, int scale) |
Write integer array response to command. | |
void | SetPlayer (GoPlayer *player) |
Set player. | |
void | Init (int size) |
void | Play (SgBlackWhite color, SgPoint move) |
Play a move in game and goto new node. | |
SgBlackWhite | BlackWhiteArg (const GtpCommand &cmd, std::size_t number) const |
SgEmptyBlackWhite | EmptyBlackWhiteArg (const GtpCommand &cmd, std::size_t number) const |
SgPoint | EmptyPointArg (const GtpCommand &cmd, std::size_t number) const |
SgPoint | MoveArg (const GtpCommand &cmd, std::size_t number) const |
SgPoint | PointArg (const GtpCommand &cmd) const |
Check that number of arguments is one and get point argument. | |
SgPoint | PointArg (const GtpCommand &cmd, std::size_t number) const |
SgVector< SgPoint > | PointListArg (const GtpCommand &cmd, std::size_t number) const |
SgVector< SgPoint > | PointListArg (const GtpCommand &cmd) const |
SgPoint | StoneArg (const GtpCommand &cmd, std::size_t number) const |
void | RulesChanged () |
Statistics file | |
virtual std::vector< std::string > | CreateStatisticsSlots () |
Create additional slots for the statistics file. | |
virtual void | AddPlayStatistics () |
Add statistics for the last generated move. | |
void | AddStatistics (const std::string &key, const std::string &value) |
See CreateStatisticsSlots(). | |
template<typename T> | |
void | AddStatistics (const std::string &key, const T &value) |
See CreateStatisticsSlots(). | |
Protected Attributes | |
GoPlayer * | m_player |
Current player. | |
boost::scoped_ptr< GoAutoBook > | m_autoBook |
Private Member Functions | |
void | AddPlayerProp (SgBlackWhite color, const std::string &name, bool overwrite) |
Add player name property to root node. | |
void | ApplyTimeSettings () |
void | AutoSave () const |
void | CheckBoardEmpty () const |
void | CreateAutoSaveFileName () |
void | GameFinished () |
Do what is necessary when a game is finished. | |
void | InitStatistics () |
void | PlaceHandicap (const SgVector< SgPoint > &stones) |
void | SaveGame (const std::string &fileName) const |
void | SaveStatistics () |
void | StartStatistics () |
void | Undo (int n) |
Static Private Member Functions | |
static void | WriteBoardInfo (GtpCommand &cmd, const GoBoard &bd) |
Write board info. | |
Private Attributes | |
bool | m_noPlayer |
bool | m_acceptIllegal |
Accept illegal ko or suicide moves in CmdPlay(). | |
bool | m_autoSave |
See SetAutoSave(). | |
bool | m_autoShowBoard |
See SetAutoShowBoard(). | |
bool | m_debugToComment |
See SetDebugToComment(). | |
int | m_fixedBoardSize |
int | m_maxClearBoard |
Maximum number of clear_board commands. | |
int | m_numberClearBoard |
Number of clear_board commands. | |
double | m_timeLastMove |
double | m_timeLimit |
See GoGtpEngine::CmdTimeLimit. | |
double | m_overhead |
Operator overhead time for time settings. | |
GoGtpTimeSettings | m_timeSettings |
Time settings for game. | |
GoRules | m_defaultRules |
Default rules. | |
GoBoard | m_board |
GoGame | m_game |
Order dependency: destruct m_game before m_board. | |
SgGtpCommands | m_sgCommands |
GoBook | m_book |
GoBookCommands | m_bookCommands |
std::string | m_autoSaveFileName |
std::string | m_autoSavePrefix |
boost::filesystem::path | m_sentinelFile |
See CmdSentinelFile(). | |
std::string | m_statisticsFile |
std::vector< std::string > | m_statisticsSlots |
See CreateStatisticsSlots(). | |
std::vector< std::string > | m_statisticsValues |
See CreateStatisticsSlots(). | |
SgMpiSynchronizerHandle | m_mpiSynchronizer |
GoGtpEngine::GoGtpEngine | ( | GtpInputStream & | in, | |
GtpOutputStream & | out, | |||
int | fixedBoardSize, | |||
const char * | programPath = 0 , |
|||
bool | noPlayer = false , |
|||
bool | noHandicap = false | |||
) |
Constructor.
in | See parameter in in GtpEngine::GtpEngine | |
out | See parameter out in GtpEngine::GtpEngine | |
fixedBoardSize | Initial and only allowed size of the board. 0 means startup with GO_DEFAULT_SIZE and allow to change board size | |
programPath | File path to the executable. Needed for SgGtpCommands::CmdDebugger | |
noPlayer | Indicate that the subclass will not set a player with SetPlayer(). Useful for GTP engines that cannot play moves (e.g. TsumeGo solvers) This causes player-specific GTP commands, like reg_genmove ) not to be registered. | |
noHandicap | Don't register handicap commands (useful, to avoid accepting handicap games on KGS) |
Definition at line 80 of file GoGtpEngine.cpp.
References CmdAllLegal(), CmdAllMoveValues(), CmdAnalyzeCommands(), CmdBoard(), CmdBoardSize(), CmdClearBoard(), CmdClock(), CmdFinalScore(), CmdFixedHandicap(), CmdGenMove(), CmdGenMoveCleanup(), CmdGetKomi(), CmdGGUndo(), CmdInterrupt(), CmdIsLegal(), CmdKgsTimeSettings(), CmdKomi(), CmdListStones(), CmdLoadSgf(), CmdParam(), CmdParamRules(), CmdParamTimecontrol(), CmdPlaceFreeHandicap(), CmdPlay(), CmdPlayerBoard(), CmdPlaySequence(), CmdPointInfo(), CmdPointNumbers(), CmdRegGenMove(), CmdRegGenMoveToPlay(), CmdRules(), CmdSaveSgf(), CmdSentinelFile(), CmdSetFreeHandicap(), CmdSetInfo(), CmdSetup(), CmdSetupPlayer(), CmdShowBoard(), CmdTimeLastMove(), CmdTimeLeft(), CmdTimeSettings(), CmdUndo(), m_bookCommands, m_sgCommands, GoBookCommands::Register(), SgGtpCommands::Register(), and GtpEngine::Register().
GoGtpEngine::~GoGtpEngine | ( | ) |
void GoGtpEngine::AddPlayerProp | ( | SgBlackWhite | color, | |
const std::string & | name, | |||
bool | overwrite | |||
) | [private] |
Add player name property to root node.
Definition at line 167 of file GoGtpEngine.cpp.
References GetGame(), SgNode::HasProp(), GoGameRecord::Root(), SgNode::SetStringProp(), SG_BLACK, SG_PROP_PLAYER, SG_PROP_PLAYER_BLACK, and SG_PROP_PLAYER_WHITE.
Referenced by CmdGenMove(), and CmdSetInfo().
void GoGtpEngine::AddPlayStatistics | ( | ) | [protected, virtual] |
Add statistics for the last generated move.
See CreateStatisticsSlots(). Default implementation does nothing.
Definition at line 177 of file GoGtpEngine.cpp.
Referenced by GenMove().
void GoGtpEngine::AddStatistics | ( | const std::string & | key, | |
const T & | value | |||
) | [protected] |
void GoGtpEngine::AddStatistics | ( | const std::string & | key, | |
const std::string & | value | |||
) | [protected] |
Definition at line 182 of file GoGtpEngine.cpp.
References m_statisticsSlots, m_statisticsValues, and SG_ASSERT.
Referenced by AddStatistics(), and GenMove().
void GoGtpEngine::ApplyTimeSettings | ( | ) | [private] |
Definition at line 199 of file GoGtpEngine.cpp.
References SgNode::Add(), Board(), GoGtpTimeSettings::ByoYomiStones(), GoGtpTimeSettings::ByoYomiTime(), GoGameRecord::CurrentNode(), GetGame(), m_overhead, m_timeSettings, GoGtpTimeSettings::MainTime(), GoGtpTimeSettings::NoTimeLimits(), GoGameRecord::Root(), SgTimeRecord::SetClock(), SgNode::SetIntProp(), SgTimeRecord::SetOTNumMoves(), SgTimeRecord::SetOTPeriod(), SgTimeRecord::SetOverhead(), SG_ASSERT, SG_BLACK, SG_PROP_OT_NU_MOVES, SG_PROP_OT_PERIOD, SG_PROP_TIME, SG_WHITE, GoGameRecord::Time(), and GoGame::TurnClockOn().
Referenced by CmdKgsTimeSettings(), CmdTimeSettings(), and Init().
void GoGtpEngine::AutoSave | ( | ) | const [private] |
Definition at line 221 of file GoGtpEngine.cpp.
References m_autoSave, m_autoSaveFileName, GtpFailure::Response(), SaveGame(), and SgWarning().
Referenced by BoardChanged(), CmdGenMove(), and CmdSetInfo().
void GoGtpEngine::BeforeHandleCommand | ( | ) | [protected, virtual] |
Hook function to be executed before each command.
Resets user abort flag. Lengthy functions should poll SgUserAbort but should not reset the user abort flag themselves. Also flushes SgDebug() (see comment at BeforeWritingResponse()).
Reimplemented from GtpEngine.
Definition at line 243 of file GoGtpEngine.cpp.
References SgDebug(), and SgSetUserAbort().
void GoGtpEngine::BeforeWritingResponse | ( | ) | [protected, virtual] |
Hook function to be executed before the response of a command is written.
Flushes SgDebug().
Reimplemented from GtpEngine.
Definition at line 249 of file GoGtpEngine.cpp.
References SgDebug().
SgBlackWhite GoGtpEngine::BlackWhiteArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
Definition at line 1285 of file GoGtpEngine.cpp.
References GoGtpCommandUtil::BlackWhiteArg().
Referenced by CmdAllLegal(), CmdGenMove(), CmdIsLegal(), CmdListStones(), CmdPlay(), CmdPlaySequence(), CmdRegGenMove(), CmdSetup(), CmdSetupPlayer(), and CmdTimeLeft().
const GoBoard & GoGtpEngine::Board | ( | ) | const [protected] |
GoBoard & GoGtpEngine::Board | ( | ) | [protected] |
Definition at line 464 of file GoGtpEngine.h.
References m_board.
Referenced by ApplyTimeSettings(), BoardChanged(), CheckBoardEmpty(), CheckLegal(), CheckMoveStackOverflow(), CmdAllLegal(), CmdAllMoveValues(), CmdBoard(), CmdBoardSize(), CmdClearBoard(), CmdFinalScore(), CmdFixedHandicap(), CmdGenMoveCleanup(), CmdGetKomi(), CmdIsLegal(), CmdKgsTimeSettings(), CmdKomi(), CmdListStones(), CmdLoadSgf(), CmdParamRules(), CmdPlaceFreeHandicap(), CmdPlayerBoard(), CmdPointInfo(), CmdPointNumbers(), CmdQuit(), CmdRegGenMoveToPlay(), CmdSetup(), CmdSetupPlayer(), CmdShowBoard(), CmdTimeSettings(), DumpState(), EmptyPointArg(), GenMove(), MoveArg(), PlaceHandicap(), PointArg(), PointListArg(), RespondNumberArray(), SetAutoShowBoard(), SetNamedRules(), and StoneArg().
void GoGtpEngine::BoardChanged | ( | ) | [protected] |
Definition at line 235 of file GoGtpEngine.cpp.
References AutoSave(), Board(), m_autoShowBoard, and SgDebug().
Referenced by CmdClearBoard(), CmdGenMove(), CmdGGUndo(), CmdLoadSgf(), CmdPlay(), CmdPlaySequence(), CmdSetup(), CmdSetupPlayer(), CmdUndo(), and PlaceHandicap().
GoBook & GoGtpEngine::Book | ( | ) |
void GoGtpEngine::CheckBoardEmpty | ( | ) | const [private] |
Definition at line 254 of file GoGtpEngine.cpp.
References Board(), SG_BLACK, SG_WHITE, and GoBoard::TotalNumStones().
Referenced by CmdPlaceFreeHandicap(), and PlaceHandicap().
void GoGtpEngine::CheckLegal | ( | std::string | message, | |
SgBlackWhite | color, | |||
SgPoint | move, | |||
bool | checkOnlyOccupied | |||
) | [protected] |
Check if move is legal.
message | Prefix for error message; move and reason will be appended | |
color | Player of move | |
move | The move | |
checkOnlyOccupied | Only check if point is empty (accepts moves that are illegal, because of the ko or suicide rules used) |
GtpFailure | if not legal. |
Definition at line 269 of file GoGtpEngine.cpp.
References Board(), GoGameRecord::CurrentMoveNumber(), GetGame(), GoRules::GetKoRule(), GoBoard::GetLastMoveInfo(), GO_MOVEFLAG_ILLEGAL, GO_MOVEFLAG_REPETITION, GO_MOVEFLAG_SUICIDE, KoRuleToString(), GoBoard::Occupied(), GoBoard::Play(), GoBoard::Rules(), SG_PASS, SgBW(), and GoBoard::Undo().
void GoGtpEngine::CheckMaxClearBoard | ( | ) | [protected] |
Definition at line 308 of file GoGtpEngine.cpp.
References m_maxClearBoard, and m_numberClearBoard.
Referenced by CmdClearBoard().
void GoGtpEngine::CheckMoveStackOverflow | ( | ) | const [protected] |
void GoGtpEngine::CmdAllLegal | ( | GtpCommand & | cmd | ) | [virtual] |
Return all legal move points.
Compatible with GNU Go's all_legal command.
Arguments: color
Definition at line 320 of file GoGtpEngine.cpp.
References BlackWhiteArg(), Board(), GtpCommand::CheckNuArg(), and SgVector< T >::PushBack().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdAllMoveValues | ( | GtpCommand & | ) | [virtual] |
Like GNU Go's all_move_values.
Definition at line 332 of file GoGtpEngine.cpp.
References Board(), GtpCommand::CheckArgNone(), GoPlayer::MoveValue(), and Player().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdAnalyzeCommands | ( | GtpCommand & | cmd | ) | [virtual] |
Return configuration for GoGui analyze commands.
See the GoGui documentation http://gogui.sf.net
Definition at line 349 of file GoGtpEngine.cpp.
References GoBookCommands::AddGoGuiAnalyzeCommands(), SgGtpCommands::AddGoGuiAnalyzeCommands(), GtpCommand::CheckArgNone(), m_bookCommands, m_noPlayer, and m_sgCommands.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdBoard | ( | GtpCommand & | cmd | ) | [virtual] |
Print some information about game board.
See WriteBoardInfo for optional arguments.
Definition at line 382 of file GoGtpEngine.cpp.
References Board(), and WriteBoardInfo().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdBoardSize | ( | GtpCommand & | ) | [virtual] |
Init new game with given board size.
Definition at line 388 of file GoGtpEngine.cpp.
References Board(), GtpCommand::CheckNuArg(), GameFinished(), Init(), GtpCommand::IntArg(), m_fixedBoardSize, SG_MAX_SIZE, and SG_MIN_SIZE.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdClearBoard | ( | GtpCommand & | cmd | ) | [virtual] |
Init new game.
Definition at line 402 of file GoGtpEngine.cpp.
References Board(), BoardChanged(), GtpCommand::CheckArgNone(), CheckMaxClearBoard(), GameFinished(), Init(), m_player, m_sentinelFile, and GoPlayer::OnNewGame().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdClock | ( | GtpCommand & | ) | [virtual] |
Show clock info from GoGameRecord::Time().
Definition at line 418 of file GoGtpEngine.cpp.
References GtpCommand::CheckArgNone(), GetGame(), and GoGameRecord::Time().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdFinalScore | ( | GtpCommand & | cmd | ) | [virtual] |
Compute final score.
Computes a final score only, if Tromp-Taylor rules are used (GoRules::CaptureDead() == true and GoRules::JapaneseScoring() == false). Otherwise it returns an error. Override this function for players that have enough knowledge to do a better scoring.
Definition at line 430 of file GoGtpEngine.cpp.
References Board(), GoRules::CaptureDead(), GtpCommand::CheckArgNone(), GoRules::JapaneseScoring(), GoRules::Komi(), GoBoard::Rules(), GoUtil::ScoreToString(), GoKomi::ToFloat(), and GoBoardUtil::TrompTaylorScore().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdFixedHandicap | ( | GtpCommand & | ) | [virtual] |
Standard GTP command fixed_handicap.
Definition at line 442 of file GoGtpEngine.cpp.
References Board(), GoGtpCommandUtil::GetHandicapStones(), GtpCommand::IntArg(), PlaceHandicap(), and GoBoard::Size().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdGenMove | ( | GtpCommand & | ) | [virtual] |
Generate and play a move.
Definition at line 451 of file GoGtpEngine.cpp.
References SgNode::AddComment(), GoGameRecord::AddMove(), AddPlayerProp(), GoGameRecord::AddResignNode(), AutoSave(), BlackWhiteArg(), BoardChanged(), GtpCommand::CheckNuArg(), GenMove(), GetGame(), GoGameRecord::GoToNode(), m_debugToComment, Player(), and SG_RESIGN.
Referenced by CmdGenMoveCleanup(), and GoGtpEngine().
void GoGtpEngine::CmdGenMoveCleanup | ( | GtpCommand & | cmd | ) | [virtual] |
Generate cleanup move.
As defined in the kgsGtp interface to the KGS Go server. Should not return pass, before all enemy dead stones are captured.
Arguments: color
final_status_list dead
command. See also bug 2157832 int the bug tracker. Definition at line 494 of file GoGtpEngine.cpp.
References Board(), GoRules::CaptureDead(), CmdGenMove(), GoBoard::Rules(), RulesChanged(), and GoRules::SetCaptureDead().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdGetKomi | ( | GtpCommand & | cmd | ) | [virtual] |
Get the komi.
Compatible to GNU Go's get_komi.
Definition at line 517 of file GoGtpEngine.cpp.
References Board(), GtpCommand::CheckArgNone(), GoRules::Komi(), and GoBoard::Rules().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdGGUndo | ( | GtpCommand & | cmd | ) | [virtual] |
Undo multiple moves.
Extension command introduced by GNU Go to undo multiple moves.
Arguments: optional int
Fails: if move history is too short
Returns: nothing
Definition at line 529 of file GoGtpEngine.cpp.
References BoardChanged(), GtpCommand::CheckNuArgLessEqual(), GtpCommand::IntArg(), GtpCommand::NuArg(), and Undo().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdInterrupt | ( | GtpCommand & | cmd | ) | [virtual] |
This command indicates that commands can be interrupted using the GoGui convention.
The command does nothing but indicate the ability to handle the special comment line # interrupt
used by GoGui. It is registered as a handler for gogui-interrupt
.
Definition at line 600 of file GoGtpEngine.cpp.
References GtpCommand::CheckArgNone().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdIsLegal | ( | GtpCommand & | cmd | ) | [virtual] |
Check if move is legal.
Compatible with GNU Go's is_legal. Arguments: color move
Returns: 0/1
Definition at line 610 of file GoGtpEngine.cpp.
References BlackWhiteArg(), Board(), GtpCommand::CheckNuArg(), and MoveArg().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdKgsTimeSettings | ( | GtpCommand & | cmd | ) | [virtual] |
Sets time settings on kgs.
Handles the four different kinds of time control on kgs, "none", "absolute", "byoyomi" (which is not currently fully supported), and "canadian".
Definition at line 541 of file GoGtpEngine.cpp.
References ApplyTimeSettings(), GtpCommand::Arg(), Board(), GtpCommand::CheckNuArg(), GtpCommand::IntArg(), m_timeSettings, GoGtpTimeSettings::NoTimeLimits(), GtpCommand::NuArg(), and SG_ASSERT.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdKomi | ( | GtpCommand & | cmd | ) | [virtual] |
Set the komi.
GTP standard command.
Definition at line 621 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), Board(), GtpCommand::CheckNuArg(), GetGame(), m_defaultRules, GoGameRecord::Root(), GoBoard::Rules(), RulesChanged(), GoRules::SetKomi(), SgNode::SetRealProp(), SG_PROP_KOMI, and SgException::what().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdListStones | ( | GtpCommand & | cmd | ) | [virtual] |
List stones on board.
Mainly useful for regression tests to verify the board position. For compatibility with GNU Go's list_stones command, the points are returned in a single line in the same order that is used by GNU Go 3.6 (A19, B19, ..., A18, B18, ...)
Arguments: color
Returns: List of stones
Definition at line 647 of file GoGtpEngine.cpp.
References GoBoard::All(), BlackWhiteArg(), Board(), GtpCommand::CheckNuArg(), SgPointSet::Contains(), Pt(), and GoBoard::Size().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdLoadSgf | ( | GtpCommand & | ) | [virtual] |
Load a position from a SGF file.
Definition at line 669 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), Board(), BoardChanged(), GtpCommand::CheckNuArgLessEqual(), GameFinished(), GetGame(), GoNodeUtil::GetHandicap(), GoNodeUtil::GetKomi(), SgGameReader::GetWarnings(), GoGameUtil::GotoBeforeMove(), GoGame::Init(), GtpCommand::IntArg(), m_defaultRules, m_player, GtpCommand::NuArg(), GoPlayer::OnNewGame(), SgGameReader::PrintWarnings(), SgGameReader::ReadGame(), GoBoard::Rules(), RulesChanged(), GoRules::SetHandicap(), GoRules::SetKomi(), SgDebug(), and SgWarning().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdName | ( | GtpCommand & | ) | [virtual] |
Return name of player, if set, GtpEngine::Name otherwise.
Reimplemented from GtpEngine.
Definition at line 705 of file GoGtpEngine.cpp.
References GtpCommand::CheckArgNone(), GtpEngine::CmdName(), m_player, and GoPlayer::Name().
void GoGtpEngine::CmdParam | ( | GtpCommand & | cmd | ) | [virtual] |
Get and set GoGtpEngine parameters.
Parameters:
auto_save
See SetAutoSave() accept_illegal
Accept illegal ko or suicide moves in CmdPlay() debug_to_comment
See SetDebugToComment() overhead
See SgTimeRecord::SetOverhead() statistics_file
See SetStatisticsFile() timelimit
See TimeLimit() Definition at line 723 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), GtpCommand::BoolArg(), GtpCommand::CheckNuArgLessEqual(), GtpCommand::FloatArg(), GetGame(), m_acceptIllegal, m_autoSave, m_autoSavePrefix, m_debugToComment, m_overhead, m_statisticsFile, m_timeLimit, GtpCommand::NuArg(), GtpCommand::RemainingLine(), SetAutoSave(), SgTimeRecord::SetOverhead(), SetStatisticsFile(), and GoGameRecord::Time().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdParamRules | ( | GtpCommand & | cmd | ) | [virtual] |
Get and set detailed rule parameters.
Changes the rules in the current game as well as the default rule.
Parameters:
allow_suicde
See GoRules:AllowSuicide() capture_dead
See GoRules:CaptureDead() extra_handicap_komi
See GoRules:ExtraHandicapKomi() japanese_scoring
See GoRules:JapaneseScoring() two_passes_end_game
See GoRules:TwoPassesEndGame() ko_rule
(simple, superko, pos_superko) See GoRules:KoRule() Definition at line 778 of file GoGtpEngine.cpp.
References GoRules::AllowSuicide(), GtpCommand::Arg(), Board(), GtpCommand::BoolArg(), GoRules::CaptureDead(), GtpCommand::CheckNuArgLessEqual(), GoRules::ExtraHandicapKomi(), GoRules::GetKoRule(), GoRules::JapaneseScoring(), KoRuleArg(), KoRuleToString(), m_defaultRules, GtpCommand::NuArg(), GoBoard::Rules(), RulesChanged(), GoRules::SetAllowSuicide(), GoRules::SetCaptureDead(), GoRules::SetExtraHandicapKomi(), GoRules::SetJapaneseScoring(), GoRules::SetKoRule(), GoRules::SetTwoPassesEndGame(), and GoRules::TwoPassesEndGame().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdParamTimecontrol | ( | GtpCommand & | cmd | ) | [virtual] |
Get and set time control parameters.
Fails if the current player is not a SgObjectWithDefaultTimeControl or the time control is not a GoTimeControl.
Parameters:
fast_open_factor
See SgDefaultTimeControl::FastOpenFactor() fast_open_moves
See SgDefaultTimeControl::FastOpenMoves() final_space
See GoTimeControl::FinalSpace() remaining_constant
See SgDefaultTimeControl::RemainingConstant() Definition at line 848 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), GtpCommand::CheckNuArgLessEqual(), SgDefaultTimeControl::FastOpenFactor(), SgDefaultTimeControl::FastOpenMoves(), GoTimeControl::FinalSpace(), GtpCommand::FloatArg(), GtpCommand::IntArg(), GtpCommand::NuArg(), Player(), SgDefaultTimeControl::RemainingConstant(), SgDefaultTimeControl::SetFastOpenFactor(), SgDefaultTimeControl::SetFastOpenMoves(), GoTimeControl::SetFinalSpace(), SgDefaultTimeControl::SetRemainingConstant(), and SgObjectWithDefaultTimeControl::TimeControl().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdPlaceFreeHandicap | ( | GtpCommand & | cmd | ) | [virtual] |
Standard GTP command place_free_handicap.
The current implementation uses the same locations as for fixed_handicap, if defined, and generates additional handicap locations by making the player play moves.
Arguments: number of handicap stones
Effect: Places handicap stones at chosen locations
Returns: Handicap stone locations
Definition at line 893 of file GoGtpEngine.cpp.
References GoSetup::AddBlack(), GoPlayer::Board(), Board(), CheckBoardEmpty(), GenMove(), GoGtpCommandUtil::GetHandicapStones(), GoBoard::Init(), GtpCommand::IntArg(), SgVector< T >::Length(), m_player, PlaceHandicap(), GoBoard::Play(), SG_ASSERT, SG_BLACK, SG_PASS, SgDebug(), and GoBoard::Size().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdPlay | ( | GtpCommand & | ) | [virtual] |
Play a move.
Definition at line 938 of file GoGtpEngine.cpp.
References BlackWhiteArg(), BoardChanged(), GtpCommand::CheckNuArg(), MoveArg(), and Play().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdPlayerBoard | ( | GtpCommand & | cmd | ) | [virtual] |
Print some information about player board.
See WriteBoardInfo for optional arguments.
Definition at line 1024 of file GoGtpEngine.cpp.
References Board(), Player(), and WriteBoardInfo().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdPlaySequence | ( | GtpCommand & | cmd | ) | [virtual] |
Play a sequence of moves.
Extension to standard play command used by GoGui.
This command is registered with the command name gogui-play_sequence
as used in newer versions of GoGui and for a transition period also with play_sequence
as used by older versions of GoGui
Definition at line 954 of file GoGtpEngine.cpp.
References BlackWhiteArg(), BoardChanged(), GoGameRecord::CurrentNode(), GetGame(), GoGameRecord::GoToNode(), MoveArg(), GtpCommand::NuArg(), and Play().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdPointInfo | ( | GtpCommand & | ) | [virtual] |
Print some information about point.
Definition at line 971 of file GoGtpEngine.cpp.
References GoBoardUtil::AdjacentBlocks(), Board(), GoBoard::GetColor(), GoBoard::InCenter(), GoBoard::InCorner(), GoBoard::IsFirst(), GoBoard::IsLegal(), GoEyeUtil::IsPossibleEye(), GoEyeUtil::IsSimpleEye(), GoEyeUtil::IsSinglePointEye(), GoBoard::IsSuicide(), GoBoard::Line(), GoEyeUtil::MakesNakadeShape(), GoBoard::Num8EmptyNeighbors(), GoBoard::NumEmptyNeighbors(), GoBoard::Occupied(), GoBoard::OnEdge(), PointArg(), GoBoard::Pos(), SG_BLACK, SG_MAXPOINT, SG_WHITE, and SgEBW().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdPointNumbers | ( | GtpCommand & | ) | [virtual] |
Show point numbers used in GoBoard.
Definition at line 1030 of file GoGtpEngine.cpp.
References Board(), GtpCommand::CheckArgNone(), and GoBoard::Size().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdQuit | ( | GtpCommand & | cmd | ) | [virtual] |
Reimplemented from GtpEngine.
Definition at line 1039 of file GoGtpEngine.cpp.
References Board(), GtpCommand::CheckArgNone(), GtpEngine::CmdQuit(), and GameFinished().
void GoGtpEngine::CmdRegGenMove | ( | GtpCommand & | cmd | ) | [virtual] |
Generate a move, but do not play it.
Like in GNU Go, if there was a random seed set, it is initialized before each reg_genmove to avoid a dependency of the random numbers on previous move generations.
Definition at line 1052 of file GoGtpEngine.cpp.
References BlackWhiteArg(), GtpCommand::CheckNuArg(), GenMove(), SgRandom::Seed(), SgRandom::SetSeed(), and SG_RESIGN.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdRegGenMoveToPlay | ( | GtpCommand & | cmd | ) | [virtual] |
Version of CmdRegGenMove() without color argument.
This is a non-standard version of reg_genmove without color argument. It generates a move for the color to play.
Definition at line 1068 of file GoGtpEngine.cpp.
References Board(), GtpCommand::CheckArgNone(), GenMove(), SgRandom::Seed(), and SgRandom::SetSeed().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdRules | ( | GtpCommand & | cmd | ) | [virtual] |
Set named rules.
Definition at line 1079 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), GtpCommand::CheckNuArg(), and SetNamedRules().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdSaveSgf | ( | GtpCommand & | cmd | ) | [virtual] |
Save current game to file.
Saves the complete game tree, including any trees from searches if storing searches is enabled with global flags.
Argument: filename
Definition at line 1098 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), GtpCommand::CheckNuArg(), and SaveGame().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdSentinelFile | ( | GtpCommand & | cmd | ) | [virtual] |
Define a file that makes future clear_board commands fail.
Defining a sentinel file can be used, for example, to abort playing on KGS, because kgsGtp.jar quits, if a clear_board command fails. This command will remove the sentinel file, if it currently exists. Future invocations of clear_board will fail, if the sentinel file exists at that time.
Argument: filename
Definition at line 1112 of file GoGtpEngine.cpp.
References GtpCommand::Arg(), GtpCommand::CheckNuArg(), and m_sentinelFile.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdSetFreeHandicap | ( | GtpCommand & | cmd | ) | [virtual] |
Standard GTP command for explicit placement of handicap stones.
Arguments: list of points
Definition at line 1132 of file GoGtpEngine.cpp.
References PlaceHandicap(), PointListArg(), and SgVector< T >::RemoveDuplicates().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdSetInfo | ( | GtpCommand & | cmd | ) | [virtual] |
Set game info property in root node of internal SGF tree.
Arguments: info value (value is remaining line after gameinfo)
Supported infos:
Definition at line 1148 of file GoGtpEngine.cpp.
References AddPlayerProp(), GtpCommand::Arg(), AutoSave(), GetGame(), GtpCommand::RemainingLine(), GoGameRecord::Root(), SgNode::SetStringProp(), SG_BLACK, SG_PROP_GAME_NAME, SG_PROP_RESULT, and SG_WHITE.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdSetup | ( | GtpCommand & | cmd | ) | [virtual] |
Place setup stones.
Command will be used by future versions of GoGui.
Argument: color point [color point ...]
With color: b, black, w, white
Definition at line 1169 of file GoGtpEngine.cpp.
References SgNode::Add(), BlackWhiteArg(), Board(), BoardChanged(), GoGameRecord::CurrentNode(), GoBoard::GetColor(), GetGame(), GoGameRecord::GoToNode(), GoBoard::MoveNumber(), SgNode::NewRightMostSon(), GtpCommand::NuArg(), PointArg(), SgPropAddStone::PushBack(), SG_BLACK, SG_PROP_ADD_BLACK, SG_PROP_ADD_WHITE, and SG_WHITE.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdSetupPlayer | ( | GtpCommand & | cmd | ) | [virtual] |
Set color to play.
Command will be used by future versions of GoGui.
Argument: color
Definition at line 1205 of file GoGtpEngine.cpp.
References SgNode::Add(), BlackWhiteArg(), Board(), BoardChanged(), GtpCommand::CheckNuArg(), GoGameRecord::CurrentNode(), GetGame(), m_player, SgNode::Props(), SgPropList::RemoveProp(), GoBoard::SetToPlay(), SG_PROP_PLAYER, and GoBoardSynchronizer::UpdateSubscriber().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdShowBoard | ( | GtpCommand & | ) | [virtual] |
Show current position.
Definition at line 1219 of file GoGtpEngine.cpp.
References Board(), and GtpCommand::CheckArgNone().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdTimeLastMove | ( | GtpCommand & | ) | [virtual] |
Time of last ganmove command.
Definition at line 1226 of file GoGtpEngine.cpp.
References GtpCommand::CheckArgNone(), and m_timeLastMove.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdTimeLeft | ( | GtpCommand & | ) | [virtual] |
Standard GTP command.
Definition at line 1233 of file GoGtpEngine.cpp.
References BlackWhiteArg(), GtpCommand::CheckNuArg(), GetGame(), GtpCommand::IntArg(), SgTimeRecord::SetMovesLeft(), SgTimeRecord::SetTimeLeft(), and GoGameRecord::Time().
Referenced by GoGtpEngine().
void GoGtpEngine::CmdTimeSettings | ( | GtpCommand & | ) | [virtual] |
Standard GTP command.
Definition at line 1248 of file GoGtpEngine.cpp.
References ApplyTimeSettings(), Board(), GtpCommand::CheckNuArg(), GtpCommand::IntArg(), and m_timeSettings.
Referenced by GoGtpEngine().
void GoGtpEngine::CmdUndo | ( | GtpCommand & | ) | [virtual] |
Undo a move.
Definition at line 1264 of file GoGtpEngine.cpp.
References BoardChanged(), GtpCommand::CheckArgNone(), and Undo().
Referenced by GoGtpEngine().
void GoGtpEngine::CreateAutoSaveFileName | ( | ) | [private] |
Definition at line 1291 of file GoGtpEngine.cpp.
References m_autoSaveFileName, and m_autoSavePrefix.
Referenced by Init(), and SetAutoSave().
std::vector< std::string > GoGtpEngine::CreateStatisticsSlots | ( | ) | [protected, virtual] |
Create additional slots for the statistics file.
This function will be called whenever a new player is set in GoGtpEngine. The default implementation returns an empty list.
Definition at line 1280 of file GoGtpEngine.cpp.
Referenced by InitStatistics().
void GoGtpEngine::DumpState | ( | std::ostream & | out | ) | const |
Write game and player boards.
Definition at line 1302 of file GoGtpEngine.cpp.
References GoPlayer::Board(), Board(), GoBoardUtil::DumpBoard(), and m_player.
Referenced by GoGtpAssertionHandler::Run().
SgEmptyBlackWhite GoGtpEngine::EmptyBlackWhiteArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
SgPoint GoGtpEngine::EmptyPointArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
Definition at line 1319 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::EmptyPointArg().
void GoGtpEngine::GameFinished | ( | ) | [private] |
Do what is necessary when a game is finished.
Note that since GTP allows arbitrary state changes, it is not always clearly defined, if a game is played and when it is finished, but this function should at least be ensured to be called at the end of a game in the use case of playing a game or a series of games.
Definition at line 1331 of file GoGtpEngine.cpp.
References m_player, and GoPlayer::OnGameFinished().
Referenced by CmdBoardSize(), CmdClearBoard(), CmdLoadSgf(), and CmdQuit().
SgPoint GoGtpEngine::GenMove | ( | SgBlackWhite | color, | |
bool | ignoreClock | |||
) | [protected] |
Definition at line 1337 of file GoGtpEngine.cpp.
References AddPlayStatistics(), AddStatistics(), Board(), CheckLegal(), CheckMoveStackOverflow(), GoPlayer::GenMove(), SgTime::Get(), GetGame(), GoBook::LookupMove(), m_autoBook, m_autoSaveFileName, m_book, m_mpiSynchronizer, m_timeLastMove, m_timeLimit, m_timeSettings, GoPlayer::Name(), GoGtpTimeSettings::NoTimeLimits(), Player(), SaveStatistics(), GoBoard::SetToPlay(), SG_ASSERT_BW, SG_NULLMOVE, SG_RESIGN, SgDebug(), StartStatistics(), and GoGameRecord::Time().
Referenced by CmdGenMove(), CmdPlaceFreeHandicap(), CmdRegGenMove(), and CmdRegGenMoveToPlay().
const GoGame & GoGtpEngine::GetGame | ( | ) | const [protected] |
GoGame & GoGtpEngine::GetGame | ( | ) | [protected] |
Definition at line 479 of file GoGtpEngine.h.
References m_game.
Referenced by AddPlayerProp(), ApplyTimeSettings(), CheckLegal(), CmdClock(), CmdGenMove(), CmdKomi(), CmdLoadSgf(), CmdParam(), CmdPlaySequence(), CmdSetInfo(), CmdSetup(), CmdSetupPlayer(), CmdTimeLeft(), GenMove(), PlaceHandicap(), Play(), SaveGame(), SetPlayer(), and Undo().
void GoGtpEngine::Init | ( | int | size | ) | [protected] |
Definition at line 1384 of file GoGtpEngine.cpp.
References ApplyTimeSettings(), CreateAutoSaveFileName(), GoGame::Init(), m_defaultRules, m_game, GoGameRecord::Root(), SgNode::SetStringProp(), and SG_PROP_DATE.
Referenced by CmdBoardSize(), and CmdClearBoard().
void GoGtpEngine::InitStatistics | ( | ) | [private] |
Definition at line 1396 of file GoGtpEngine.cpp.
References CreateStatisticsSlots(), m_statisticsFile, m_statisticsSlots, and MpiSynchronizer().
Referenced by SetPlayer(), and SetStatisticsFile().
SgPoint GoGtpEngine::MoveArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
Definition at line 1435 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::MoveArg().
Referenced by CmdIsLegal(), CmdPlay(), and CmdPlaySequence().
const SgMpiSynchronizerHandle GoGtpEngine::MpiSynchronizer | ( | ) | const |
SgMpiSynchronizerHandle GoGtpEngine::MpiSynchronizer | ( | ) |
Definition at line 1706 of file GoGtpEngine.cpp.
References m_mpiSynchronizer.
Referenced by GoBookCommands::CmdSave(), GoBookCommands::CmdSaveAs(), InitStatistics(), SaveGame(), and SaveStatistics().
Definition at line 1440 of file GoGtpEngine.cpp.
References SgNode::Add(), Board(), BoardChanged(), CheckBoardEmpty(), GoGameRecord::CurrentNode(), GetGame(), GoGameRecord::GoToNode(), SgNode::HasSon(), SgNode::NewRightMostSon(), SgPropAddStone::PushBack(), GoBoard::Rules(), RulesChanged(), GoRules::SetHandicap(), SG_PROP_ADD_BLACK, and SG_PROP_HANDICAP.
Referenced by CmdFixedHandicap(), CmdPlaceFreeHandicap(), and CmdSetFreeHandicap().
void GoGtpEngine::Play | ( | SgBlackWhite | color, | |
SgPoint | move | |||
) | [protected] |
Play a move in game and goto new node.
GtpFailure | If move stack overflow or illegal move. |
Definition at line 1460 of file GoGtpEngine.cpp.
References GoGameRecord::AddMove(), CheckLegal(), CheckMoveStackOverflow(), GetGame(), GoGameRecord::GoToNode(), m_acceptIllegal, and SG_RESIGN.
Referenced by CmdPlay(), and CmdPlaySequence().
GoPlayer & GoGtpEngine::Player | ( | ) | const [protected] |
Throws GtpFailure if no player set.
Definition at line 1473 of file GoGtpEngine.cpp.
References m_player.
Referenced by CmdAllMoveValues(), CmdGenMove(), CmdParamTimecontrol(), CmdPlayerBoard(), and GenMove().
SgPoint GoGtpEngine::PointArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
Definition at line 1485 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::PointArg().
SgPoint GoGtpEngine::PointArg | ( | const GtpCommand & | cmd | ) | const [protected] |
Check that number of arguments is one and get point argument.
Definition at line 1480 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::PointArg().
Referenced by CmdPointInfo(), and CmdSetup().
SgVector< SgPoint > GoGtpEngine::PointListArg | ( | const GtpCommand & | cmd | ) | const [protected] |
Definition at line 1496 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::PointListArg().
SgVector< SgPoint > GoGtpEngine::PointListArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
Definition at line 1490 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::PointListArg().
Referenced by CmdSetFreeHandicap().
void GoGtpEngine::RespondNumberArray | ( | GtpCommand & | cmd, | |
const SgPointArray< int > & | array, | |||
int | scale | |||
) | [protected] |
Write integer array response to command.
Elements with the value numeric_limits<int>::min() are considered to have no defined value and are written as "" for compatibility with GoGui.
Definition at line 1501 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::RespondNumberArray().
void GoGtpEngine::RulesChanged | ( | ) | [protected] |
Definition at line 1508 of file GoGtpEngine.cpp.
References m_player, and GoBoardSynchronizer::UpdateSubscriber().
Referenced by CmdGenMoveCleanup(), CmdKomi(), CmdLoadSgf(), CmdParamRules(), PlaceHandicap(), and SetNamedRules().
void GoGtpEngine::SaveGame | ( | const std::string & | fileName | ) | const [private] |
Definition at line 1514 of file GoGtpEngine.cpp.
References GetGame(), MpiSynchronizer(), and SgException::what().
Referenced by AutoSave(), and CmdSaveSgf().
void GoGtpEngine::SaveStatistics | ( | ) | [private] |
Definition at line 1531 of file GoGtpEngine.cpp.
References m_statisticsFile, m_statisticsSlots, m_statisticsValues, MpiSynchronizer(), and SG_ASSERT.
Referenced by GenMove().
void GoGtpEngine::SetAutoSave | ( | const std::string & | prefix | ) |
Automatically save game after each move.
prefix | Filename prefix; game number and file extension sgf will be added. |
Definition at line 1550 of file GoGtpEngine.cpp.
References CreateAutoSaveFileName(), m_autoSave, and m_autoSavePrefix.
Referenced by CmdParam().
void GoGtpEngine::SetAutoShowBoard | ( | bool | showBoard | ) |
Automatically write board to SgDebug() after changes.
Default is false.
Definition at line 1557 of file GoGtpEngine.cpp.
References Board(), m_autoShowBoard, and SgDebug().
void GoGtpEngine::SetDebugToComment | ( | bool | debugToComment | ) |
Write everything written to SgDebug() during a genmove command to the comment in the new game node.
During a genmove command, SgDebug() will be redirected to a string stream. After the move generation, SgDebug() will be reset to its old value and the string will be written to SgDebug(), as well as added as a comment to the new game node. Default is false.
Definition at line 489 of file GoGtpEngine.h.
References m_debugToComment.
void GoGtpEngine::SetMaxClearBoard | ( | int | n | ) |
Set maximum number of clear_board commands.
-1 means no limit (default). After the limit is reached, the clear_board command will fail. This limit can be used to limit the game loop of the Computer bot interface to the Kiseido Go server http://kgs.kiseido.com.
Definition at line 494 of file GoGtpEngine.h.
References m_maxClearBoard.
void GoGtpEngine::SetMpiSynchronizer | ( | const SgMpiSynchronizerHandle & | m_handle | ) |
void GoGtpEngine::SetNamedRules | ( | const std::string & | namedRules | ) |
Set named rules.
namedRules | Named rules. |
SgException | on unknown rules. |
Definition at line 1580 of file GoGtpEngine.cpp.
References Board(), m_defaultRules, GoBoard::Rules(), RulesChanged(), and GoRules::SetNamedRules().
Referenced by CmdRules().
void GoGtpEngine::SetPlayer | ( | GoPlayer * | player | ) | [protected] |
Set player.
Takes ownership of player.
Definition at line 1570 of file GoGtpEngine.cpp.
References GetGame(), InitStatistics(), m_player, GoPlayer::OnNewGame(), GoGame::SetPlayer(), SG_BLACK, and SG_WHITE.
void GoGtpEngine::SetStatisticsFile | ( | const std::string & | fileName | ) |
File to save statistics.
An empty string means that the statistics will not be saved (default behavior).
Definition at line 1564 of file GoGtpEngine.cpp.
References InitStatistics(), and m_statisticsFile.
Referenced by CmdParam().
void GoGtpEngine::SetTimeLimit | ( | double | timeLimit | ) |
void GoGtpEngine::StartStatistics | ( | ) | [private] |
Definition at line 1587 of file GoGtpEngine.cpp.
References m_statisticsSlots, and m_statisticsValues.
Referenced by GenMove().
SgPoint GoGtpEngine::StoneArg | ( | const GtpCommand & | cmd, | |
std::size_t | number | |||
) | const [protected] |
Definition at line 1593 of file GoGtpEngine.cpp.
References Board(), and GoGtpCommandUtil::StoneArg().
double GoGtpEngine::TimeLimit | ( | ) |
Time limit in seconds for move generation and other commands.
Definition at line 504 of file GoGtpEngine.h.
References m_timeLimit.
void GoGtpEngine::Undo | ( | int | n | ) | [private] |
Definition at line 1598 of file GoGtpEngine.cpp.
References GoGameRecord::CurrentNode(), SgNode::Father(), GetGame(), GoGameRecord::GoToNode(), SgNode::HasFather(), SgNode::HasNodeMove(), and SG_ASSERT.
Referenced by CmdGGUndo(), and CmdUndo().
void GoGtpEngine::WriteBoardInfo | ( | GtpCommand & | cmd, | |
const GoBoard & | bd | |||
) | [static, private] |
Write board info.
Optional arguments:
Definition at line 1616 of file GoGtpEngine.cpp.
References GoBoard::All(), GoBoard::AllEmpty(), GoBoard::AllPoints(), GtpCommand::Arg(), GoBoard::Centers(), GtpCommand::CheckNuArgLessEqual(), GoBoard::Corners(), GoBoard::CountPlay(), GoBoard::Edges(), GoBoard::GetHashCode(), GoBoard::GetHashCodeInclToPlay(), GoBoard::KoColor(), GoBoard::MoveNumber(), GtpCommand::NuArg(), GoBoard::Occupied(), SG_BLACK, SG_WHITE, SgBW(), SgEBW(), GoBoard::SideExtensions(), GoBoard::ToPlay(), GoBoard::TotalNumEmpty(), and GoBoard::TotalNumStones().
Referenced by CmdBoard(), and CmdPlayerBoard().
bool GoGtpEngine::m_acceptIllegal [private] |
Accept illegal ko or suicide moves in CmdPlay().
Definition at line 360 of file GoGtpEngine.h.
Referenced by CmdParam(), and Play().
boost::scoped_ptr<GoAutoBook> GoGtpEngine::m_autoBook [protected] |
bool GoGtpEngine::m_autoSave [private] |
See SetAutoSave().
Definition at line 363 of file GoGtpEngine.h.
Referenced by AutoSave(), CmdParam(), and SetAutoSave().
std::string GoGtpEngine::m_autoSaveFileName [private] |
Definition at line 411 of file GoGtpEngine.h.
Referenced by AutoSave(), CreateAutoSaveFileName(), and GenMove().
std::string GoGtpEngine::m_autoSavePrefix [private] |
Definition at line 413 of file GoGtpEngine.h.
Referenced by CmdParam(), CreateAutoSaveFileName(), and SetAutoSave().
bool GoGtpEngine::m_autoShowBoard [private] |
See SetAutoShowBoard().
Definition at line 366 of file GoGtpEngine.h.
Referenced by BoardChanged(), and SetAutoShowBoard().
GoBoard GoGtpEngine::m_board [private] |
GoBook GoGtpEngine::m_book [private] |
GoBookCommands GoGtpEngine::m_bookCommands [private] |
Definition at line 409 of file GoGtpEngine.h.
Referenced by CmdAnalyzeCommands(), and GoGtpEngine().
bool GoGtpEngine::m_debugToComment [private] |
See SetDebugToComment().
Definition at line 369 of file GoGtpEngine.h.
Referenced by CmdGenMove(), CmdParam(), and SetDebugToComment().
GoRules GoGtpEngine::m_defaultRules [private] |
Default rules.
Will be used whenever a new game is started.
Definition at line 398 of file GoGtpEngine.h.
Referenced by CmdKomi(), CmdLoadSgf(), CmdParamRules(), Init(), and SetNamedRules().
int GoGtpEngine::m_fixedBoardSize [private] |
GoGame GoGtpEngine::m_game [private] |
int GoGtpEngine::m_maxClearBoard [private] |
Maximum number of clear_board commands.
-1, if no limit.
Definition at line 377 of file GoGtpEngine.h.
Referenced by CheckMaxClearBoard(), and SetMaxClearBoard().
Definition at line 426 of file GoGtpEngine.h.
Referenced by GenMove(), MpiSynchronizer(), and SetMpiSynchronizer().
bool GoGtpEngine::m_noPlayer [private] |
int GoGtpEngine::m_numberClearBoard [private] |
Number of clear_board commands.
Definition at line 382 of file GoGtpEngine.h.
Referenced by CheckMaxClearBoard().
double GoGtpEngine::m_overhead [private] |
Operator overhead time for time settings.
Definition at line 390 of file GoGtpEngine.h.
Referenced by ApplyTimeSettings(), and CmdParam().
GoPlayer* GoGtpEngine::m_player [protected] |
Current player.
The player can be exchanged at runtime. It is null, if no player is set. This member is accessible by subclasses of GoGtpEngine to allow them to register external classes, which handle player specific GTP commands. These external classes can be constructed with a reference to this pointer, such that they can access the player they need. They have to check first, that the current player is the expected one.
Definition at line 240 of file GoGtpEngine.h.
Referenced by CmdClearBoard(), CmdLoadSgf(), CmdName(), CmdPlaceFreeHandicap(), CmdSetupPlayer(), DumpState(), GameFinished(), Player(), RulesChanged(), SetPlayer(), and ~GoGtpEngine().
boost::filesystem::path GoGtpEngine::m_sentinelFile [private] |
See CmdSentinelFile().
Definition at line 416 of file GoGtpEngine.h.
Referenced by CmdClearBoard(), and CmdSentinelFile().
SgGtpCommands GoGtpEngine::m_sgCommands [private] |
Definition at line 405 of file GoGtpEngine.h.
Referenced by CmdAnalyzeCommands(), and GoGtpEngine().
std::string GoGtpEngine::m_statisticsFile [private] |
Definition at line 418 of file GoGtpEngine.h.
Referenced by CmdParam(), InitStatistics(), SaveStatistics(), and SetStatisticsFile().
std::vector<std::string> GoGtpEngine::m_statisticsSlots [private] |
Definition at line 421 of file GoGtpEngine.h.
Referenced by AddStatistics(), InitStatistics(), SaveStatistics(), and StartStatistics().
std::vector<std::string> GoGtpEngine::m_statisticsValues [private] |
Definition at line 424 of file GoGtpEngine.h.
Referenced by AddStatistics(), SaveStatistics(), and StartStatistics().
double GoGtpEngine::m_timeLastMove [private] |
double GoGtpEngine::m_timeLimit [private] |
See GoGtpEngine::CmdTimeLimit.
Definition at line 387 of file GoGtpEngine.h.
Referenced by CmdParam(), GenMove(), SetTimeLimit(), and TimeLimit().
GoGtpTimeSettings GoGtpEngine::m_timeSettings [private] |
Time settings for game.
Definition at line 393 of file GoGtpEngine.h.
Referenced by ApplyTimeSettings(), CmdKgsTimeSettings(), CmdTimeSettings(), and GenMove().