00001 //---------------------------------------------------------------------------- 00002 /** @file MoHexEngine.hpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef MOHEXENGINE_HPP 00007 #define MOHEXEENGINE_HPP 00008 00009 #include "Hex.hpp" 00010 #include "BenzeneHtpEngine.hpp" 00011 #include "BookBuilderCommands.hpp" 00012 #include "MoHexPlayer.hpp" 00013 00014 _BEGIN_BENZENE_NAMESPACE_ 00015 00016 //---------------------------------------------------------------------------- 00017 00018 /** Htp engine for MoHex. */ 00019 class MoHexEngine : public BenzeneHtpEngine 00020 { 00021 public: 00022 00023 MoHexEngine(int boardsize, MoHexPlayer& player); 00024 00025 ~MoHexEngine(); 00026 00027 /** @name Command Callbacks */ 00028 // @{ 00029 00030 void MoHexParam(HtpCommand& cmd); 00031 void MoHexPolicyParam(HtpCommand& cmd); 00032 void SaveTree(HtpCommand& cmd); 00033 void SaveGames(HtpCommand& cmd); 00034 void Values(HtpCommand& cmd); 00035 void RaveValues(HtpCommand& cmd); 00036 void Bounds(HtpCommand& cmd); 00037 00038 // @} // @name 00039 00040 #if GTPENGINE_PONDER 00041 virtual void Ponder(); 00042 00043 virtual void InitPonder(); 00044 00045 virtual void StopPonder(); 00046 #endif 00047 00048 double TimeForMove(HexColor color); 00049 00050 private: 00051 00052 MoHexPlayer& m_player; 00053 00054 boost::scoped_ptr<Book> m_book; 00055 00056 BookCheck m_bookCheck; 00057 00058 BookBuilderCommands<MoHexPlayer> m_bookCommands; 00059 00060 HexPoint GenMove(HexColor color, bool useGameClock); 00061 00062 HexPoint DoSearch(HexColor color, double maxTime); 00063 00064 void RegisterCmd(const std::string& name, 00065 GtpCallback<MoHexEngine>::Method method); 00066 }; 00067 00068 //---------------------------------------------------------------------------- 00069 00070 _END_BENZENE_NAMESPACE_ 00071 00072 #endif // MOHEXENGINE_HPP