1 //----------------------------------------------------------------------------- 2 /** @file pentobi_gtp/GtpEngine.h 3 @author Markus Enzenberger 4 @copyright GNU General Public License version 3 or later */ 5 //----------------------------------------------------------------------------- 6 7 #ifndef PENTOBI_GTP_GTP_ENGINE_H 8 #define PENTOBI_GTP_GTP_ENGINE_H 9 10 #include "libpentobi_gtp/GtpEngine.h" 11 #include "libpentobi_mcts/Player.h" 12 13 using namespace std; 14 using libboardgame_gtp::Arguments; 15 using libboardgame_gtp::Response; 16 using libpentobi_base::PlayerBase; 17 using libpentobi_base::Variant; 18 using libpentobi_mcts::Player; 19 using libpentobi_mcts::Search; 20 21 //----------------------------------------------------------------------------- 22 23 class GtpEngine 24 : public libpentobi_gtp::GtpEngine 25 { 26 public: 27 explicit GtpEngine( 28 Variant variant, unsigned level = 5, bool use_book = true, 29 const string& books_dir = {}, unsigned nu_threads = 0); 30 31 ~GtpEngine() override; 32 33 void cmd_param(Arguments args, Response& response); 34 void cmd_get_value(Response& response); 35 void cmd_move_values(Response& response); 36 void cmd_name(Response& response); 37 void cmd_selfplay(Arguments args); 38 void cmd_save_tree(Arguments args); 39 void cmd_version(Response& response); 40 41 Player& get_mcts_player(); 42 43 /** @see Player::use_cpu_time() */ 44 void use_cpu_time(bool enable); 45 46 private: 47 unique_ptr<PlayerBase> m_player; 48 49 void create_player(Variant variant, unsigned level, 50 const string& books_dir, unsigned nu_threads); 51 52 Search& get_search(); 53 }; 54 55 //----------------------------------------------------------------------------- 56 57 #endif // PENTOBI_GTP_GTP_ENGINE_H 58