Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Types | Public Member Functions | Private Attributes

GoRules Class Reference

Parameters describing game rules and handicap. More...

#include <GoRules.h>

List of all members.

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 GoKomiKomi () 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

Detailed Description

Parameters describing game rules and handicap.

Definition at line 16 of file GoRules.h.


Member Enumeration Documentation

Ko rule.

Enumerator:
POS_SUPERKO 

Positional superko.

Full board repetition is forbidden, independent on who is to play.

SIMPLEKO 

Only repetition of the position two moves ago is forbidden.

SUPERKO 

Situational superko.

Full board repetition is forbidden, including who is to play.

Definition at line 20 of file GoRules.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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
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
bool GoRules::operator!= ( const GoRules rules  )  const

Definition at line 173 of file GoRules.h.

bool GoRules::operator== ( const GoRules rules  )  const
void GoRules::SetAllowSuicide ( bool  allowSuicide  ) 
void GoRules::SetCaptureDead ( bool  captureDead  ) 
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
Parameters:
namedRules The named rules.
Exceptions:
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().


Member Data Documentation

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().

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().

Definition at line 166 of file GoRules.h.

Referenced by JapaneseHandicap(), operator==(), and SetJapaneseHandicap().

Definition at line 155 of file GoRules.h.

Referenced by JapaneseScoring(), operator==(), and SetJapaneseScoring().

The komi.

Definition at line 164 of file GoRules.h.

Referenced by Komi(), operator==(), and SetKomi().

Definition at line 170 of file GoRules.h.

Referenced by GetKoRule(), operator==(), and SetKoRule().

Definition at line 168 of file GoRules.h.

Referenced by operator==(), SetTwoPassesEndGame(), and TwoPassesEndGame().


The documentation for this class was generated from the following files:


Sun Mar 13 2011 Doxygen 1.7.1