00001 //---------------------------------------------------------------------------- 00002 /** @file GoSetup.h 00003 Initial setup information for GoBoard. */ 00004 //---------------------------------------------------------------------------- 00005 00006 #ifndef GO_SETUP_H 00007 #define GO_SETUP_H 00008 00009 #include "SgBlackWhite.h" 00010 #include "SgBWSet.h" 00011 #include "SgPoint.h" 00012 00013 //---------------------------------------------------------------------------- 00014 00015 /** Setup information for start position in GoBoard. */ 00016 class GoSetup 00017 { 00018 public: 00019 SgBWSet m_stones; 00020 00021 SgBlackWhite m_player; 00022 00023 /** Create empty setup. 00024 Contains no setup stones. Black is to move. */ 00025 GoSetup(); 00026 00027 bool operator==(const GoSetup& setup) const; 00028 00029 bool operator!=(const GoSetup& setup) const; 00030 00031 /** Add a black stone. 00032 Convenience function. Equivalent to @c m_stones[SG_BLACK].Include(p) */ 00033 void AddBlack(SgPoint p); 00034 00035 /** Add a black stone. 00036 Convenience function. Equivalent to @c m_stones[SG_WHITE].Include(p) */ 00037 void AddWhite(SgPoint p); 00038 00039 /** Does the setup contain no setup stones and is the player Black. */ 00040 bool IsEmpty() const; 00041 }; 00042 00043 inline GoSetup::GoSetup() 00044 : m_player(SG_BLACK) 00045 { 00046 } 00047 00048 inline bool GoSetup::operator==(const GoSetup& setup) const 00049 { 00050 return (m_stones == setup.m_stones && m_player == setup.m_player); 00051 } 00052 00053 inline bool GoSetup::operator!=(const GoSetup& setup) const 00054 { 00055 return ! operator==(setup); 00056 } 00057 00058 inline void GoSetup::AddBlack(SgPoint p) 00059 { 00060 m_stones[SG_BLACK].Include(p); 00061 } 00062 00063 inline void GoSetup::AddWhite(SgPoint p) 00064 { 00065 m_stones[SG_WHITE].Include(p); 00066 } 00067 00068 inline bool GoSetup::IsEmpty() const 00069 { 00070 return (m_stones.BothEmpty() && m_player == SG_BLACK); 00071 } 00072 00073 //---------------------------------------------------------------------------- 00074 00075 #endif // GO_SETUP_H 00076