Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GoBoardHistory.h

Go to the documentation of this file.
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 class GoBoardHistory
00022 {
00023 public:
00024     /** Constructor.
00025         The initial state is that the history does not correspond to any
00026         valid position. */
00027     GoBoardHistory();
00028 
00029     /** Initialize from a current board position. */
00030     void SetFromBoard(const GoBoard& bd);
00031 
00032     /** Check if this position is a alternate-play follow-up to another one.
00033         @param other The other position
00034         @param[out] sequence The sequence leading from the other position to
00035         this one
00036         @return @c true If the position is a follow-up */
00037     bool IsAlternatePlayFollowUpOf(const GoBoardHistory& other,
00038                                    std::vector<SgPoint>& sequence);
00039 
00040 private:
00041     int m_boardSize;
00042 
00043     GoRules m_rules;
00044 
00045     GoSetup m_setup;
00046 
00047     SgArrayList<GoPlayerMove,GO_MAX_NUM_MOVES> m_moves;
00048 
00049     SgBlackWhite m_toPlay;
00050 };
00051 
00052 inline GoBoardHistory::GoBoardHistory()
00053     : m_boardSize(-1)
00054 {
00055 }
00056 
00057 //----------------------------------------------------------------------------
00058 
00059 #endif // GOBOARDHISTORY_H


Sun Mar 13 2011 Doxygen 1.7.1