#include <GoRules.h>
Definition at line 17 of file GoRules.h.
Public Types | |
POS_SUPERKO | |
Positional superko. | |
SIMPLEKO | |
Only repetition of the position two moves ago is forbidden. | |
SUPERKO | |
Situational superko. | |
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 |
enum GoRules::KoRule |
GoRules::GoRules | ( | int | handicap = 0 , |
|
const GoKomi & | komi = GoKomi(6.5) , |
|||
bool | japanese = false , |
|||
bool | twoPassesEndGame = true | |||
) |
Definition at line 18 of file GoRules.cpp.
bool GoRules::AllowSuicide | ( | ) | const |
Default is false.
Definition at line 185 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 190 of file GoRules.h.
References m_captureDead.
Referenced by GoGtpEngine::CmdFinalScore(), GoGtpEngine::CmdGenMoveCleanup(), GoGtpEngine::CmdParamRules(), and GoBoardUtil::PassWins().
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 195 of file GoRules.h.
References m_extraHandicapKomi.
Referenced by GoGtpEngine::CmdParamRules().
GoRules::KoRule GoRules::GetKoRule | ( | ) | const |
Definition at line 200 of file GoRules.h.
References m_koRule.
Referenced by GoGtpEngine::CheckLegal(), GoGtpEngine::CmdParamRules(), and GoBoard::FullBoardRepetition().
int GoRules::Handicap | ( | ) | const |
Definition at line 205 of file GoRules.h.
References m_handicap.
Referenced by GoGameRecord::InitFromRoot(), GoGameRecord::OnInitHandicap(), and GoBoardUtil::RemainingChineseHandicap().
bool GoRules::JapaneseHandicap | ( | ) | const |
True if using Japanese style handicap.
Definition at line 210 of file GoRules.h.
References m_japaneseHandicap.
Referenced by GoGameRecord::OnInitHandicap(), 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 215 of file GoRules.h.
References m_japaneseScoring.
Referenced by GoGtpEngine::CmdFinalScore(), GoGtpEngine::CmdParamRules(), and GoBoardUtil::PassWins().
const GoKomi & GoRules::Komi | ( | ) | const |
Definition at line 220 of file GoRules.h.
References m_komi.
Referenced by GoGtpEngine::CmdFinalScore(), GoGtpEngine::CmdGetKomi(), GoGameRecord::InitFromRoot(), and GoBoardUtil::PassWins().
bool GoRules::operator== | ( | const GoRules & | rules | ) | const |
Definition at line 32 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 225 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 230 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 235 of file GoRules.h.
References m_extraHandicapKomi.
Referenced by GoGtpEngine::CmdParamRules(), and SetNamedRules().
void GoRules::SetHandicap | ( | int | handicap | ) |
Definition at line 240 of file GoRules.h.
References m_handicap, and SG_ASSERT.
Referenced by GoGtpEngine::CmdLoadSgf(), and GoGtpEngine::PlaceHandicap().
void GoRules::SetJapaneseHandicap | ( | bool | japaneseHandicap | ) |
Definition at line 246 of file GoRules.h.
References m_japaneseHandicap.
Referenced by SetNamedRules().
void GoRules::SetJapaneseScoring | ( | bool | japaneseScoring | ) |
Definition at line 251 of file GoRules.h.
References m_japaneseScoring.
Referenced by GoGtpEngine::CmdParamRules(), and SetNamedRules().
void GoRules::SetKomi | ( | const GoKomi & | komi | ) |
Definition at line 256 of file GoRules.h.
References m_komi.
Referenced by GoGtpEngine::CmdKomi(), and GoGtpEngine::CmdLoadSgf().
void GoRules::SetKoRule | ( | KoRule | koRule | ) |
Definition at line 261 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 45 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 266 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 271 of file GoRules.h.
References m_twoPassesEndGame.
Referenced by GoGtpEngine::CmdParamRules(), and GoBoardUtil::EndOfGame().
bool GoRules::m_allowSuicide [private] |
Definition at line 158 of file GoRules.h.
Referenced by AllowSuicide(), operator==(), and SetAllowSuicide().
bool GoRules::m_captureDead [private] |
Definition at line 160 of file GoRules.h.
Referenced by CaptureDead(), operator==(), and SetCaptureDead().
bool GoRules::m_extraHandicapKomi [private] |
See ExtraHandicapKomi().
Definition at line 165 of file GoRules.h.
Referenced by ExtraHandicapKomi(), operator==(), and SetExtraHandicapKomi().
int GoRules::m_handicap [private] |
Initial handicap for this game.
Definition at line 168 of file GoRules.h.
Referenced by Handicap(), operator==(), and SetHandicap().
bool GoRules::m_japaneseHandicap [private] |
Definition at line 173 of file GoRules.h.
Referenced by JapaneseHandicap(), operator==(), and SetJapaneseHandicap().
bool GoRules::m_japaneseScoring [private] |
Definition at line 162 of file GoRules.h.
Referenced by JapaneseScoring(), operator==(), and SetJapaneseScoring().
GoKomi GoRules::m_komi [private] |
The komi.
Definition at line 171 of file GoRules.h.
Referenced by Komi(), operator==(), and SetKomi().
KoRule GoRules::m_koRule [private] |
bool GoRules::m_twoPassesEndGame [private] |
Definition at line 175 of file GoRules.h.
Referenced by operator==(), SetTwoPassesEndGame(), and TwoPassesEndGame().