00001 //---------------------------------------------------------------------------- 00002 /** @file BenzeneHtpEngine.hpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef BENZENEHTPENGINE_H 00007 #define BENZENEHTPENGINE_H 00008 00009 #include "BenzenePlayer.hpp" 00010 #include "DfpnCommands.hpp" 00011 #include "HexEnvironment.hpp" 00012 #include "HexHtpEngine.hpp" 00013 #include "DfsSolver.hpp" 00014 #include "DfsCommands.hpp" 00015 #include "SolverDB.hpp" 00016 #include "VCCommands.hpp" 00017 00018 _BEGIN_BENZENE_NAMESPACE_ 00019 00020 //---------------------------------------------------------------------------- 00021 00022 /** HTP engine with commands for stuff common to all UofA Hex 00023 players. */ 00024 class BenzeneHtpEngine: public HexHtpEngine 00025 { 00026 public: 00027 BenzeneHtpEngine(int boardsize); 00028 00029 ~BenzeneHtpEngine(); 00030 00031 /** @page benzenehtpenginecommands BenzeneHtpEngine Commands 00032 - @link CmdLicense() @c benzene-license @endlink 00033 - @link CmdGetAbsorbGroup() @c get_absorb_group @endlink 00034 - @link CmdHandbookAdd() @c handbook-add @endlink 00035 - @link CmdComputeInferior() @c compute-inferior @endlink 00036 - @link CmdComputeFillin() @c compute-fillin @endlink 00037 - @link CmdComputeVulnerable() @c compute-vulnerable @endlink 00038 - @link CmdComputeReversible() @c compute-reversible @endlink 00039 - @link CmdComputeDominated() @c compute-dominated @endlink 00040 - @link CmdComputeDominatedOnCell() @c compute-dominated-cell @endlink 00041 - @link CmdFindCombDecomp() @c find-comb-decomp @endlink 00042 - @link CmdFindSplitDecomp() @c find-split-decomp @endlink 00043 - @link CmdEncodePattern() @c encode-pattern @endlink 00044 - @link CmdParamDfpn() @c param_dfpn @endlink 00045 - @link CmdEvalTwoDist() @c eval-twod @endlink 00046 - @link CmdEvalResist() @c eval-resist @endlink 00047 - @link CmdEvalResistDelta() @c eval-resist-delta @endlink 00048 - @link CmdEvalInfluence() @c eval-influence @endlink 00049 - @link CmdMiscDebug() @c misc_debug @endlink 00050 */ 00051 00052 /** @name Command Callbacks */ 00053 // @{ 00054 // The callback functions are documented in the cpp file 00055 00056 void CmdLicense(HtpCommand& cmd); 00057 00058 void CmdGetAbsorbGroup(HtpCommand& cmd); 00059 00060 void CmdHandbookAdd(HtpCommand& cmd); 00061 00062 void CmdComputeInferior(HtpCommand& cmd); 00063 void CmdComputeFillin(HtpCommand& cmd); 00064 void CmdComputeVulnerable(HtpCommand& cmd); 00065 void CmdComputeReversible(HtpCommand& cmd); 00066 void CmdComputeDominated(HtpCommand& cmd); 00067 void CmdComputeDominatedOnCell(HtpCommand& cmd); 00068 void CmdFindCombDecomp(HtpCommand& cmd); 00069 void CmdFindSplitDecomp(HtpCommand& cmd); 00070 void CmdEncodePattern(HtpCommand& cmd); 00071 00072 void CmdParamDfpn(HtpCommand& cmd); 00073 00074 void CmdEvalTwoDist(HtpCommand& cmd); 00075 void CmdEvalResist(HtpCommand& cmd); 00076 void CmdEvalResistDelta(HtpCommand& cmd); 00077 void CmdEvalInfluence(HtpCommand& cmd); 00078 00079 void CmdMiscDebug(HtpCommand& cmd); 00080 00081 // @} // @name 00082 00083 protected: 00084 00085 /** Player's environment. */ 00086 HexEnvironment m_pe; 00087 00088 /** Solver's environment. */ 00089 HexEnvironment m_se; 00090 00091 DfsSolver m_dfsSolver; 00092 00093 DfpnSolver m_dfpnSolver; 00094 00095 boost::scoped_ptr<DfsHashTable> m_dfsHashTable; 00096 00097 boost::scoped_ptr<DfpnHashTable> m_dfpnHashTable; 00098 00099 boost::scoped_ptr<DfsDB> m_dfsDB; 00100 00101 boost::scoped_ptr<DfpnDB> m_dfpnDB; 00102 00103 SolverDBParameters m_dfsParam; 00104 00105 SolverDBParameters m_dfpnParam; 00106 00107 SolverDB<DfsHashTable, DfsDB, DfsData> m_dfsPositions; 00108 00109 SolverDB<DfpnHashTable, DfpnDB, DfpnData> m_dfpnPositions; 00110 00111 HexEnvironmentCommands m_playerEnvCommands; 00112 00113 HexEnvironmentCommands m_solverEnvCommands; 00114 00115 VCCommands m_vcCommands; 00116 00117 DfsCommands m_dfsSolverCommands; 00118 00119 DfpnCommands m_dfpnSolverCommands; 00120 00121 bool m_useParallelSolver; 00122 00123 virtual void NewGame(int width, int height); 00124 00125 void ParamPlayer(BenzenePlayer* player, HtpCommand& cmd); 00126 00127 private: 00128 00129 void RegisterCmd(const std::string& name, 00130 GtpCallback<BenzeneHtpEngine>::Method method); 00131 }; 00132 00133 //---------------------------------------------------------------------------- 00134 00135 _END_BENZENE_NAMESPACE_ 00136 00137 #endif // BENZENEHTPENGINE_H