00001 //---------------------------------------------------------------------------- 00002 /** @file GoGtpTimeSettings.h 00003 Time settings as used in time_settings standard GTP command. 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #ifndef GO_GTPTIMESETTINGS_H 00008 #define GO_GTPTIMESETTINGS_H 00009 00010 //---------------------------------------------------------------------------- 00011 00012 /** Time settings as used in time_settings standard GTP command. */ 00013 class GoGtpTimeSettings 00014 { 00015 public: 00016 /** Construct time settings with no time limit. */ 00017 GoGtpTimeSettings(); 00018 00019 /** Construct time settings. 00020 Supports Canadian byo yomi, including absolute time (no byo yomi) 00021 as a special case. 00022 Setting mainTime=0 means that the engine immediately starts in byo 00023 yomi. Setting byoYomiTime means that if the main time is up before 00024 the game is over, the engine loses on time. Setting byoYomiTime>0 00025 and byoYomiStones=0 means no time limits. 00026 @param mainTime Main time measured in seconds. 00027 @param byoYomiTime Byo yomi time measured in seconds. 00028 @param byoYomiStones Number of stones per byo yomi period. 00029 */ 00030 GoGtpTimeSettings(int mainTime, int byoYomiTime, int byoYomiStones); 00031 00032 bool operator==(const GoGtpTimeSettings& timeSettings) const; 00033 00034 int MainTime() const; 00035 00036 int ByoYomiTime() const; 00037 00038 int ByoYomiStones() const; 00039 00040 /** Check if no time limits are used. 00041 Equivalent to byoYomiTime>0 and byoYomiStones=0. 00042 */ 00043 bool NoTimeLimits() const; 00044 00045 private: 00046 /** Main time measured in seconds. */ 00047 int m_mainTime; 00048 00049 /** Byo yomi time measured in seconds. */ 00050 int m_byoYomiTime; 00051 00052 /** Number of stones per byo yomi period. */ 00053 int m_byoYomiStones; 00054 }; 00055 00056 inline int GoGtpTimeSettings::MainTime() const 00057 { 00058 return m_mainTime; 00059 } 00060 00061 inline int GoGtpTimeSettings::ByoYomiTime() const 00062 { 00063 return m_byoYomiTime; 00064 } 00065 00066 inline int GoGtpTimeSettings::ByoYomiStones() const 00067 { 00068 return m_byoYomiStones; 00069 } 00070 00071 //---------------------------------------------------------------------------- 00072 00073 #endif // GO_GTPTIMESETTINGS_H 00074