00001 //---------------------------------------------------------------------------- 00002 /** @file GoSearch.h 00003 Class GoSearch extends SgSearch */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef GO_SEARCH_H 00007 #define GO_SEARCH_H 00008 00009 #include "SgSearch.h" 00010 00011 class GoBoard; 00012 00013 //---------------------------------------------------------------------------- 00014 00015 /** Go search. 00016 Defines EndOfGame to return true after two passes. */ 00017 class GoSearch 00018 : public SgSearch 00019 { 00020 public: 00021 GoSearch(GoBoard& board, SgSearchHashTable* hash); 00022 00023 GoBoard& Board(); 00024 00025 const GoBoard& Board() const; 00026 00027 /** Return false, because some Go searches require it. 00028 @todo Remove. Implement it in the subclasses, because it depends on 00029 the move generation there. */ 00030 bool CheckDepthLimitReached() const; 00031 00032 bool EndOfGame() const; 00033 00034 /** Default implementation of SgSearch::Execute() for Go searches. 00035 Executes the move is legal. */ 00036 bool Execute(SgMove move, int* delta, int depth); 00037 00038 /** Default implementation of SgSearch::GetHashCode() for Go searches. 00039 @return Board().GetHashCodeInclToPlay(). */ 00040 SgHashCode GetHashCode() const; 00041 00042 /** Default implementation of SgSearch::ToPlay() for Go searches. 00043 @return Board().ToPlay(). */ 00044 SgBlackWhite GetToPlay() const; 00045 00046 void SetToPlay(SgBlackWhite toPlay); 00047 00048 std::string MoveString(SgMove move) const; 00049 00050 /** Default implementation of SgSearch::TakeBack() for Go searches. 00051 Takes back the move on the board. */ 00052 void TakeBack(); 00053 00054 private: 00055 GoBoard& m_board; 00056 }; 00057 00058 inline GoBoard& GoSearch::Board() 00059 { 00060 return m_board; 00061 } 00062 00063 inline const GoBoard& GoSearch::Board() const 00064 { 00065 return m_board; 00066 } 00067 00068 //---------------------------------------------------------------------------- 00069 00070 #endif // GO_SEARCH_H