00001 //---------------------------------------------------------------------------- 00002 /** @file GoBoardHistory.h */ 00003 //---------------------------------------------------------------------------- 00004 00005 #ifndef GOBOARDHISTORY_H 00006 #define GOBOARDHISTORY_H 00007 00008 #include <vector> 00009 #include "GoBoard.h" 00010 00011 //---------------------------------------------------------------------------- 00012 00013 /** Identifier for board state including history. 00014 This class can be used, for instance, to uniquely remember a board 00015 position for reusing parts of previous computations. The state includes: 00016 - the board size 00017 - the rules 00018 - the setup stones and color to play before any moves were played 00019 - the history of moves (needed if super-ko rules are used) 00020 - the current color to play 00021 */ 00022 class GoBoardHistory 00023 { 00024 public: 00025 /** Constructor. 00026 The initial state is that the history does not correspond to any 00027 valid position. 00028 */ 00029 GoBoardHistory(); 00030 00031 /** Initialize from a current board position. */ 00032 void SetFromBoard(const GoBoard& bd); 00033 00034 /** Check if this position is a alternate-play follow-up to another one. 00035 @param other The other position 00036 @param[out] sequence The sequence leading from the other position to 00037 this one 00038 @return @c true If the position is a follow-up 00039 */ 00040 bool IsAlternatePlayFollowUpOf(const GoBoardHistory& other, 00041 std::vector<SgPoint>& sequence); 00042 00043 private: 00044 int m_boardSize; 00045 00046 GoRules m_rules; 00047 00048 GoSetup m_setup; 00049 00050 SgSList<GoPlayerMove,GO_MAX_NUM_MOVES> m_moves; 00051 00052 SgBlackWhite m_toPlay; 00053 }; 00054 00055 inline GoBoardHistory::GoBoardHistory() 00056 : m_boardSize(-1) 00057 { 00058 } 00059 00060 //---------------------------------------------------------------------------- 00061 00062 #endif // GOBOARDHISTORY_H