Parameters describing game rules and handicap. More...
#include <GoRules.h>
Public Types | |
enum | KoRule { POS_SUPERKO, SIMPLEKO, SUPERKO } |
Ko rule. More... | |
Public Member Functions | |
GoRules (int handicap=0, const GoKomi &komi=GoKomi(6.5), bool japanese=false, bool twoPassesEndGame=true) | |
bool | operator== (const GoRules &rules) const |
bool | operator!= (const GoRules &rules) const |
void | SetNamedRules (const std::string &namedRules) |
Set several rule settings according to rule name. | |
Set and query rule details | |
bool | AllowSuicide () const |
Default is false. | |
void | SetAllowSuicide (bool allowSuicide) |
bool | CaptureDead () const |
Whether it necessary to capture dead stones. | |
void | SetCaptureDead (bool captureDead) |
See CaptureDead(). | |
KoRule | GetKoRule () const |
void | SetKoRule (KoRule koRule) |
int | Handicap () const |
void | SetHandicap (int handicap) |
bool | JapaneseHandicap () const |
True if using Japanese style handicap. | |
void | SetJapaneseHandicap (bool japaneseHandicap) |
bool | JapaneseScoring () const |
True if using Japanese style scoring. | |
void | SetJapaneseScoring (bool japaneseScoring) |
const GoKomi & | Komi () const |
void | SetKomi (const GoKomi &komi) |
bool | TwoPassesEndGame () const |
True if two passes end the game, false if 3 passes needed. | |
void | SetTwoPassesEndGame (bool twoPassesEndGame) |
bool | ExtraHandicapKomi () const |
Each handicap stone counts as an extra komi point for white. | |
void | SetExtraHandicapKomi (bool enable) |
See ExtraHandicapKomi(). | |
Private Attributes | |
bool | m_allowSuicide |
bool | m_captureDead |
bool | m_japaneseScoring |
bool | m_extraHandicapKomi |
See ExtraHandicapKomi(). | |
int | m_handicap |
Initial handicap for this game. | |
GoKomi | m_komi |
The komi. | |
bool | m_japaneseHandicap |
bool | m_twoPassesEndGame |
KoRule | m_koRule |
Parameters describing game rules and handicap.
Definition at line 16 of file GoRules.h.
enum GoRules::KoRule |
GoRules::GoRules | ( | int | handicap = 0 , |
|
const GoKomi & | komi = GoKomi(6.5) , |
|||
bool | japanese = false , |
|||
bool | twoPassesEndGame = true | |||
) |
Definition at line 17 of file GoRules.cpp.
bool GoRules::AllowSuicide | ( | ) | const |
Default is false.
Definition at line 178 of file GoRules.h.
References m_allowSuicide.
Referenced by GoBoard::CheckSuicide(), GoGtpEngine::CmdParamRules(), and GoBoardUtil::PlayIfLegal().
bool GoRules::CaptureDead | ( | ) | const |
Whether it necessary to capture dead stones.
With some rules all un-captured stones count as alive. Default is false.
Definition at line 183 of file GoRules.h.
References m_captureDead.
Referenced by GoGtpEngine::CmdFinalScore(), GoGtpEngine::CmdGenMoveCleanup(), GoGtpEngine::CmdParamRules(), and GoBoardUtil::TrompTaylorPassWins().
bool GoRules::ExtraHandicapKomi | ( | ) | const |
Each handicap stone counts as an extra komi point for white.
This extra komi point is not included in the komi settings. Used by the KGS Go server. Default is false.
Definition at line 188 of file GoRules.h.
References m_extraHandicapKomi.
Referenced by GoGtpEngine::CmdParamRules().
GoRules::KoRule GoRules::GetKoRule | ( | ) | const |
Definition at line 193 of file GoRules.h.
References m_koRule.
Referenced by GoGtpEngine::CheckLegal(), GoGtpEngine::CmdParamRules(), and GoBoard::FullBoardRepetition().
int GoRules::Handicap | ( | ) | const |
Definition at line 198 of file GoRules.h.
References m_handicap.
Referenced by GoGame::Init(), GoGame::InitHandicap(), and GoBoardUtil::RemainingChineseHandicap().
bool GoRules::JapaneseHandicap | ( | ) | const |
True if using Japanese style handicap.
Definition at line 203 of file GoRules.h.
References m_japaneseHandicap.
Referenced by GoGame::InitHandicap(), and GoBoardUtil::RemainingChineseHandicap().
bool GoRules::JapaneseScoring | ( | ) | const |
True if using Japanese style scoring.
Japanese style scoring counts territory and prisoners, but not own stones.
Definition at line 208 of file GoRules.h.
References m_japaneseScoring.
Referenced by GoGtpEngine::CmdFinalScore(), GoGtpEngine::CmdParamRules(), GoBoardUtil::ScorePosition(), and GoBoardUtil::TrompTaylorPassWins().
const GoKomi & GoRules::Komi | ( | ) | const |
Definition at line 213 of file GoRules.h.
References m_komi.
Referenced by GoGtpEngine::CmdFinalScore(), GoGtpEngine::CmdGetKomi(), GoSafetyUtil::GetWinner(), GoGame::Init(), GoBoardUtil::ScorePosition(), GoGame::SetRulesGlobal(), and GoBoardUtil::TrompTaylorPassWins().
bool GoRules::operator== | ( | const GoRules & | rules | ) | const |
Definition at line 31 of file GoRules.cpp.
References m_allowSuicide, m_captureDead, m_extraHandicapKomi, m_handicap, m_japaneseHandicap, m_japaneseScoring, m_komi, m_koRule, and m_twoPassesEndGame.
void GoRules::SetAllowSuicide | ( | bool | allowSuicide | ) |
Definition at line 218 of file GoRules.h.
References m_allowSuicide.
Referenced by GoGtpEngine::CmdParamRules(), GoRestoreRepetitionAndSuicide::GoRestoreRepetitionAndSuicide(), GoRestoreSuicide::GoRestoreSuicide(), SetNamedRules(), GoRestoreRepetitionAndSuicide::~GoRestoreRepetitionAndSuicide(), and GoRestoreSuicide::~GoRestoreSuicide().
void GoRules::SetCaptureDead | ( | bool | captureDead | ) |
See CaptureDead().
Definition at line 223 of file GoRules.h.
References m_captureDead.
Referenced by GoGtpEngine::CmdGenMoveCleanup(), GoGtpEngine::CmdParamRules(), and SetNamedRules().
void GoRules::SetExtraHandicapKomi | ( | bool | enable | ) |
See ExtraHandicapKomi().
Definition at line 228 of file GoRules.h.
References m_extraHandicapKomi.
Referenced by GoGtpEngine::CmdParamRules(), and SetNamedRules().
void GoRules::SetHandicap | ( | int | handicap | ) |
Definition at line 233 of file GoRules.h.
References m_handicap, and SG_ASSERT.
Referenced by GoGtpEngine::CmdLoadSgf(), and GoGame::PlaceHandicap().
void GoRules::SetJapaneseHandicap | ( | bool | japaneseHandicap | ) |
Definition at line 239 of file GoRules.h.
References m_japaneseHandicap.
Referenced by SetNamedRules().
void GoRules::SetJapaneseScoring | ( | bool | japaneseScoring | ) |
Definition at line 244 of file GoRules.h.
References m_japaneseScoring.
Referenced by GoGtpEngine::CmdParamRules(), and SetNamedRules().
void GoRules::SetKomi | ( | const GoKomi & | komi | ) |
Definition at line 249 of file GoRules.h.
References m_komi.
Referenced by GoGtpEngine::CmdKomi(), GoGtpEngine::CmdLoadSgf(), and GoGame::SetKomiGlobal().
void GoRules::SetKoRule | ( | KoRule | koRule | ) |
Definition at line 254 of file GoRules.h.
References m_koRule.
Referenced by GoGtpEngine::CmdParamRules(), SetNamedRules(), and GoRestoreKoRule::~GoRestoreKoRule().
void GoRules::SetNamedRules | ( | const std::string & | namedRules | ) |
Set several rule settings according to rule name.
Currently supported:
Name | Suicide | JapaneseHandicap | JapaneseScoring | KoRule | CaptureDead | ExtraHandicapKomi |
---|---|---|---|---|---|---|
cgos | no | no | no | positional superko | yes | no |
chinese | no | no | no | positional superko | no | no |
japanese | no | yes | yes | simple | no | no |
kgs | no | no | no | positional superko | no | yes |
namedRules | The named rules. |
SgException | If rule name is not known. |
Definition at line 44 of file GoRules.cpp.
References POS_SUPERKO, SetAllowSuicide(), SetCaptureDead(), SetExtraHandicapKomi(), SetJapaneseHandicap(), SetJapaneseScoring(), SetKoRule(), and SIMPLEKO.
Referenced by GoGtpEngine::SetNamedRules().
void GoRules::SetTwoPassesEndGame | ( | bool | twoPassesEndGame | ) |
Definition at line 259 of file GoRules.h.
References m_twoPassesEndGame.
Referenced by GoGtpEngine::CmdParamRules().
bool GoRules::TwoPassesEndGame | ( | ) | const |
True if two passes end the game, false if 3 passes needed.
Definition at line 264 of file GoRules.h.
References m_twoPassesEndGame.
Referenced by GoGtpEngine::CmdParamRules(), and GoBoardUtil::EndOfGame().
bool GoRules::m_allowSuicide [private] |
Definition at line 151 of file GoRules.h.
Referenced by AllowSuicide(), operator==(), and SetAllowSuicide().
bool GoRules::m_captureDead [private] |
Definition at line 153 of file GoRules.h.
Referenced by CaptureDead(), operator==(), and SetCaptureDead().
bool GoRules::m_extraHandicapKomi [private] |
See ExtraHandicapKomi().
Definition at line 158 of file GoRules.h.
Referenced by ExtraHandicapKomi(), operator==(), and SetExtraHandicapKomi().
int GoRules::m_handicap [private] |
Initial handicap for this game.
Definition at line 161 of file GoRules.h.
Referenced by Handicap(), operator==(), and SetHandicap().
bool GoRules::m_japaneseHandicap [private] |
Definition at line 166 of file GoRules.h.
Referenced by JapaneseHandicap(), operator==(), and SetJapaneseHandicap().
bool GoRules::m_japaneseScoring [private] |
Definition at line 155 of file GoRules.h.
Referenced by JapaneseScoring(), operator==(), and SetJapaneseScoring().
GoKomi GoRules::m_komi [private] |
The komi.
Definition at line 164 of file GoRules.h.
Referenced by Komi(), operator==(), and SetKomi().
KoRule GoRules::m_koRule [private] |
Definition at line 170 of file GoRules.h.
Referenced by GetKoRule(), operator==(), and SetKoRule().
bool GoRules::m_twoPassesEndGame [private] |
Definition at line 168 of file GoRules.h.
Referenced by operator==(), SetTwoPassesEndGame(), and TwoPassesEndGame().