00001 //---------------------------------------------------------------------------- 00002 /** @file GoUctDefaultRootFilter.h */ 00003 //---------------------------------------------------------------------------- 00004 00005 #ifndef GOUCT_DEFAULTROOTFILTER_H 00006 #define GOUCT_DEFAULTROOTFILTER_H 00007 00008 #include "GoLadder.h" 00009 #include "GoUctRootFilter.h" 00010 00011 class GoBoard; 00012 00013 //---------------------------------------------------------------------------- 00014 00015 /** Default root filter used by GoUctPlayer. */ 00016 class GoUctDefaultRootFilter 00017 : public GoUctRootFilter 00018 { 00019 public: 00020 GoUctDefaultRootFilter(const GoBoard& bd); 00021 00022 /** @name Pure virtual functions of GoUctRootFilter */ 00023 // @{ 00024 00025 /** Get moves to filter in the current position. 00026 This function is invoked by the player before the search, it does not 00027 need to be thread-safe. 00028 */ 00029 std::vector<SgPoint> Get(); 00030 00031 // @} // @name 00032 00033 00034 /** @name Parameters */ 00035 // @{ 00036 00037 /** Prune unsuccesful ladder defense moves (unless the ladder would be 00038 short). 00039 */ 00040 bool CheckLadders() const; 00041 00042 /** See CheckLadders() */ 00043 void SetCheckLadders(bool enable); 00044 00045 // @} // @name 00046 00047 private: 00048 const GoBoard& m_bd; 00049 00050 GoLadder m_ladder; 00051 00052 /** See CheckLadders() */ 00053 bool m_checkLadders; 00054 00055 /** Minimum ladder length necessary to prune loosing ladder defense moves. 00056 @see m_checkLadders 00057 */ 00058 int m_minLadderLength; 00059 00060 /** Local variable in Get(). 00061 Reused for efficiency. 00062 */ 00063 mutable SgVector<SgPoint> m_ladderSequence; 00064 }; 00065 00066 inline bool GoUctDefaultRootFilter::CheckLadders() const 00067 { 00068 return m_checkLadders; 00069 } 00070 00071 inline void GoUctDefaultRootFilter::SetCheckLadders(bool enable) 00072 { 00073 m_checkLadders = enable; 00074 } 00075 00076 //---------------------------------------------------------------------------- 00077 00078 #endif // GOUCT_DEFAULTROOTFILTER_H