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 std::vector<SgPoint> Get(); 00029 00030 // @} // @name 00031 00032 00033 /** @name Parameters */ 00034 // @{ 00035 00036 /** Prune unsuccesful ladder defense moves (unless the ladder would be 00037 short). */ 00038 bool CheckLadders() const; 00039 00040 /** See CheckLadders() */ 00041 void SetCheckLadders(bool enable); 00042 00043 // @} // @name 00044 00045 private: 00046 const GoBoard& m_bd; 00047 00048 GoLadder m_ladder; 00049 00050 /** See CheckLadders() */ 00051 bool m_checkLadders; 00052 00053 /** Minimum ladder length necessary to prune loosing ladder defense moves. 00054 @see m_checkLadders */ 00055 int m_minLadderLength; 00056 00057 /** Local variable in Get(). 00058 Reused for efficiency. */ 00059 mutable SgVector<SgPoint> m_ladderSequence; 00060 }; 00061 00062 inline bool GoUctDefaultRootFilter::CheckLadders() const 00063 { 00064 return m_checkLadders; 00065 } 00066 00067 inline void GoUctDefaultRootFilter::SetCheckLadders(bool enable) 00068 { 00069 m_checkLadders = enable; 00070 } 00071 00072 //---------------------------------------------------------------------------- 00073 00074 #endif // GOUCT_DEFAULTROOTFILTER_H