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