00001 //---------------------------------------------------------------------------- 00002 /** @file GoUctCommands.h 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef GOUCT_COMMANDS_H 00007 #define GOUCT_COMMANDS_H 00008 00009 #include <string> 00010 #include "GtpEngine.h" 00011 #include "GoUctPlayoutPolicy.h" 00012 #include "GoUctGlobalSearch.h" 00013 #include "GoUctPlayer.h" 00014 00015 class GoBoard; 00016 class GoPlayer; 00017 class GoUctBoard; 00018 class GoUctSearch; 00019 00020 //---------------------------------------------------------------------------- 00021 00022 /** GTP commands for GoUctPlayer. 00023 Some of the commands are also usable for other players, as long as they 00024 use a subclass of GoUctSearch (and implement GoUctObjectWithSearch). 00025 */ 00026 class GoUctCommands 00027 { 00028 public: 00029 /** Constructor. 00030 @param bd The game board. 00031 @param player Reference to pointer to current player, this player can 00032 be null or a different player, but those commands of this class that 00033 need a GoUctPlayer will fail, if the current player is not 00034 GoUctPlayer. 00035 */ 00036 GoUctCommands(GoBoard& bd, GoPlayer*& player); 00037 00038 void AddGoGuiAnalyzeCommands(GtpCommand& cmd); 00039 00040 /** @page gouctgtpcommands GoUctCommands Commands 00041 - @link CmdFinalScore() @c final_score @endlink 00042 - @link CmdFinalStatusList() @c final_status_list @endlink 00043 - @link CmdBounds() @c uct_bounds @endlink 00044 - @link CmdDefaultPolicy() @c uct_default_policy @endlink 00045 - @link CmdEstimatorStat() @c uct_estimator_stat @endlink 00046 - @link CmdGfx() @c uct_gfx @endlink 00047 - @link CmdMaxMemory() @c uct_max_memory @endlink 00048 - @link CmdMoves() @c uct_moves @endlink 00049 - @link CmdParamGlobalSearch() @c uct_param_globalsearch @endlink 00050 - @link CmdParamPolicy() @c uct_param_policy @endlink 00051 - @link CmdParamPlayer() @c uct_param_player @endlink 00052 - @link CmdParamRootFilter() @c uct_param_rootfilter @endlink 00053 - @link CmdParamSearch() @c uct_param_search @endlink 00054 - @link CmdPatterns() @c uct_patterns @endlink 00055 - @link CmdPolicyMoves() @c uct_policy_moves @endlink 00056 - @link CmdPriorKnowledge() @c uct_prior_knowledge @endlink 00057 - @link CmdRaveValues() @c uct_rave_values @endlink 00058 - @link CmdRootFilter() @c uct_root_filter @endlink 00059 - @link CmdSaveGames() @c uct_savegames @endlink 00060 - @link CmdSaveTree() @c uct_savetree @endlink 00061 - @link CmdSequence() @c uct_sequence @endlink 00062 - @link CmdScore() @c uct_score @endlink 00063 - @link CmdStatPlayer() @c uct_stat_player @endlink 00064 - @link CmdStatPlayerClear() @c uct_stat_player_clear @endlink 00065 - @link CmdStatPolicy() @c uct_stat_policy @endlink 00066 - @link CmdStatPolicyClear() @c uct_stat_policy_clear @endlink 00067 - @link CmdStatSearch() @c uct_stat_search @endlink 00068 - @link CmdStatTerritory() @c uct_stat_territory @endlink 00069 - @link CmdValue() @c uct_value @endlink 00070 - @link CmdValueBlack() @c uct_value_black @endlink 00071 */ 00072 /** @name Command Callbacks */ 00073 // @{ 00074 // The callback functions are documented in the cpp file 00075 void CmdBounds(GtpCommand& cmd); 00076 void CmdDefaultPolicy(GtpCommand& cmd); 00077 void CmdEstimatorStat(GtpCommand& cmd); 00078 void CmdFinalScore(GtpCommand&); 00079 void CmdFinalStatusList(GtpCommand&); 00080 void CmdGfx(GtpCommand& cmd); 00081 void CmdMaxMemory(GtpCommand& cmd); 00082 void CmdMoves(GtpCommand& cmd); 00083 void CmdParamGlobalSearch(GtpCommand& cmd); 00084 void CmdParamPolicy(GtpCommand& cmd); 00085 void CmdParamPlayer(GtpCommand& cmd); 00086 void CmdParamRootFilter(GtpCommand& cmd); 00087 void CmdParamSearch(GtpCommand& cmd); 00088 void CmdPatterns(GtpCommand& cmd); 00089 void CmdPolicyMoves(GtpCommand& cmd); 00090 void CmdPriorKnowledge(GtpCommand& cmd); 00091 void CmdRaveValues(GtpCommand& cmd); 00092 void CmdRootFilter(GtpCommand& cmd); 00093 void CmdSaveGames(GtpCommand& cmd); 00094 void CmdSaveTree(GtpCommand& cmd); 00095 void CmdScore(GtpCommand& cmd); 00096 void CmdSequence(GtpCommand& cmd); 00097 void CmdStatPlayer(GtpCommand& cmd); 00098 void CmdStatPlayerClear(GtpCommand& cmd); 00099 void CmdStatPolicy(GtpCommand& cmd); 00100 void CmdStatPolicyClear(GtpCommand& cmd); 00101 void CmdStatSearch(GtpCommand& cmd); 00102 void CmdStatTerritory(GtpCommand& cmd); 00103 void CmdValue(GtpCommand& cmd); 00104 void CmdValueBlack(GtpCommand& cmd); 00105 // @} // @name 00106 00107 void Register(GtpEngine& engine); 00108 00109 private: 00110 GoBoard& m_bd; 00111 00112 GoPlayer*& m_player; 00113 00114 SgPointSet DoFinalStatusSearch(); 00115 00116 GoUctGlobalSearch<GoUctPlayoutPolicy<GoUctBoard>, 00117 GoUctPlayoutPolicyFactory<GoUctBoard> >& 00118 GlobalSearch(); 00119 00120 GoUctPlayer<GoUctGlobalSearch<GoUctPlayoutPolicy<GoUctBoard>, 00121 GoUctPlayoutPolicyFactory<GoUctBoard> >, 00122 GoUctGlobalSearchState<GoUctPlayoutPolicy<GoUctBoard> > >& 00123 Player(); 00124 00125 GoUctPlayoutPolicy<GoUctBoard>& Policy(std::size_t threadId); 00126 00127 void Register(GtpEngine& e, const std::string& command, 00128 GtpCallback<GoUctCommands>::Method method); 00129 00130 GoUctSearch& Search(); 00131 00132 GoUctGlobalSearchState<GoUctPlayoutPolicy<GoUctBoard> >& 00133 ThreadState(std::size_t threadId); 00134 }; 00135 00136 //---------------------------------------------------------------------------- 00137 00138 #endif // GOUCT_COMMANDS_H