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