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

GoBoard Class Reference

Go board. More...

#include <GoBoard.h>

List of all members.

Classes

class  Block
 Data related to a block of stones on the board. More...
class  HashCode
 Board hash code. More...
class  Iterator
 Iterate through all points. More...
class  LibertyCopyIterator
 Iterate through all the liberties of a block. More...
class  LibertyIterator
 Iterate through all the liberties of a block. More...
struct  Snapshot
struct  StackEntry
 Information to undo a move. More...
struct  State
 Data that can be restored quickly with TakeSnapshot/RestoreSnapshot. More...
class  StoneIterator
 Iterate through all the stones of a block. More...

Public Member Functions

 GoBoard (int size=GO_DEFAULT_SIZE, const GoSetup &setup=GoSetup(), const GoRules &rules=GoRules())
 ~GoBoard ()
const SgBoardConstBoardConst () const
uint64_t CountPlay () const
 Number of calls to Play since creation of this board.
void Init (int size, const GoSetup &setup=GoSetup())
 Re-initializes the board with new size.
void Init (int size, const GoRules &rules, const GoSetup &setup=GoSetup())
 Re-initializes the board with new size and rules.
GoRulesRules ()
 Non-const access to current game rules.
const GoRulesRules () const
 Current game rules.
SgGrid Size () const
 Return the size of this board.
bool StackOverflowLikely () const
 Check if sufficient space on internal stacks.
bool IsFirst (SgPoint p) const
 Check if move at point would be the first move there.
bool IsNewPosition () const
 Check if board is in a definitely new situation, with no possibility of repetition.
bool Occupied (SgPoint p) const
 Check if point is occupied by a stone.
bool IsEmpty (SgPoint p) const
bool IsBorder (SgPoint p) const
bool IsColor (SgPoint p, int c) const
SgBoardColor GetColor (SgPoint p) const
SgBlackWhite GetStone (SgPoint p) const
SgBlackWhite ToPlay () const
 Player whose turn it is to play.
SgBlackWhite Opponent () const
 Opponent of player whose turn it is to play.
void SetToPlay (SgBlackWhite player)
 Set the current player.
SgGrid Line (SgPoint p) const
 See SgBoardConst::Line.
SgGrid Pos (SgPoint p) const
 See SgBoardConst::Pos.
int Up (SgPoint p) const
 Returns the offset to the point on the line above this point.
int Left (SgPoint p) const
 Returns the offset along left side of the board.
int Right (SgPoint p) const
 Returns the offset along right side of the board.
int Side (SgPoint p, int index) const
 Same as Left/Right, but the side is passed in as an index (0 or 1).
bool IsSuicide (SgPoint p, SgBlackWhite toPlay) const
bool IsValidPoint (SgPoint p) const
bool HasEmptyNeighbors (SgPoint p) const
int NumEmptyNeighbors (SgPoint p) const
int Num8EmptyNeighbors (SgPoint p) const
 Includes diagonals.
bool HasNeighbors (SgPoint p, SgBlackWhite c) const
int NumNeighbors (SgPoint p, SgBlackWhite c) const
int Num8Neighbors (SgPoint p, SgBlackWhite c) const
 Includes diagonals.
bool HasDiagonals (SgPoint p, SgBoardColor c) const
int NumDiagonals (SgPoint p, SgBoardColor c) const
int NumEmptyDiagonals (SgPoint p) const
bool HasNeighborsOrDiags (SgPoint p, SgBlackWhite c) const
bool InCorner (SgPoint p) const
bool OnEdge (SgPoint p) const
bool InCenter (SgPoint p) const
int FirstBoardPoint () const
 See SgBoardConst::FirstBoardPoint.
int LastBoardPoint () const
 See SgBoardConst::FirstBoardPoint.
bool LastMoveInfo (GoMoveInfoFlag flag) const
 Information about the most recent call to Play.
GoMoveInfo GetLastMoveInfo () const
void AllowKoRepetition (bool allowKo)
void AllowAnyRepetition (bool allowAny)
 Make all repetition moves legal.
void SetKoModifiesHash (bool modify)
 Enable modification of hash code by Ko moves.
bool KoRepetitionAllowed () const
bool AnyRepetitionAllowed () const
 Are all repetition moves legal?
bool KoModifiesHash () const
void Play (SgPoint p, SgBlackWhite player)
 Play a move.
void Play (SgPoint p)
 Play a move for the current player.
void Play (GoPlayerMove move)
 Play a move.
void Undo ()
 Undo the most recent move.
bool CanUndo () const
 Whether there is any move to undo.
bool IsLegal (int p, SgBlackWhite player) const
 Check whether the move at 'p' is legal.
bool IsLegal (int p) const
 Check whether the move at 'p' is legal for color to play.
bool IsSuicide (SgPoint p) const
bool CapturingMove () const
 Whether the most recent move captured any stones.
const GoPointListCapturedStones () const
 The stones removed from the board by the most recent move.
int NuCapturedStones () const
 The stones captured by the most recent move.
int NumPrisoners (SgBlackWhite color) const
 The total number of stones of 'color' that have been captured by the opponent throughout the game.
const GoSetupSetup () const
 Setup information of the first position.
int MoveNumber () const
 Return the current number moves.
GoPlayerMove Move (int i) const
 Return move with a certain move number.
SgPoint GetLastMove () const
 Return last move played.
SgPoint Get2ndLastMove () const
 2nd Last move = last move by ToPlay().
SgPoint KoPoint () const
 Point which is currently illegal due to simple ko rule.
const SgHashCodeGetHashCode () const
 Return hash code for this position.
SgHashCode GetHashCodeInclToPlay () const
 Return hash code for this position, modified by whose turn it is to play.
int NumStones (SgPoint p) const
 Return the number of stones in the block at 'p'.
bool IsSingleStone (SgPoint p) const
 Return NumStones(p) == 1.
bool AreInSameBlock (SgPoint stone1, SgPoint stone2) const
 Return whether the two stones are located in the same block.
SgPoint Anchor (SgPoint p) const
 Return the smallest point of the block at a point.
bool IsInBlock (SgPoint p, SgPoint anchor) const
 Efficient combined test if point is occupied and belongs to a block.
bool IsLibertyOfBlock (SgPoint p, SgPoint anchor) const
 Check if empty point is a liberty of block.
int AdjacentBlocks (SgPoint p, int maxLib, SgPoint anchors[], int maxAnchors) const
 Get adjacent opponent blocks with a maximum number of liberties for a given block.
void NeighborBlocks (SgPoint p, SgBlackWhite c, SgPoint anchors[]) const
 List anchor of each block of color 'c' adjacent to the empty point 'p'.
void NeighborBlocks (SgPoint p, SgBlackWhite c, int maxLib, SgPoint anchors[]) const
 List anchor of each block of color 'c' with at most 'maxLib' liberties adjacent to the empty point 'p'.
const SgBWArray< int > & TotalNumStones () const
 Number of stones currently on the board.
int TotalNumStones (SgBlackWhite color) const
int TotalNumEmpty () const
 Number of empty points currently on the board.
SgPoint TheLiberty (SgPoint blockInAtari) const
 Return the liberty of 'blockInAtari' which must have exactly one liberty.
int NumLiberties (SgPoint p) const
 Return the number of liberties of the block at 'p'.
bool AtMostNumLibs (SgPoint block, int n) const
 Return whether block has at most n liberties.
bool AtLeastNumLibs (SgPoint block, int n) const
 Return whether block has at least n liberties.
bool InAtari (SgPoint p) const
 Return whether the number of liberties of the block at 'p' is one.
bool OccupiedInAtari (SgPoint p) const
 Check if point is occupied and in atari.
bool CanCapture (SgPoint p, SgBlackWhite c) const
 Return whether playing colour c at p can capture anything, ignoring any possible repetition.
SgEmptyBlackWhite KoColor () const
 Player who has immediately retaken a ko.
int KoLevel () const
 Number of times that KoColor has immediately retaken a ko.
SgEmptyBlackWhite KoLoser () const
 Player who will lose any ko.
void SetKoLoser (SgEmptyBlackWhite color)
 See KoLoser.
void CheckConsistency () const
 Checks whether all the board data structures are in a consistent state.
void TakeSnapshot ()
 Remember current position for quickly undoing a sequence of moves.
void RestoreSnapshot ()
 Restore a snapshot.
Point sets

SgPointSet Occupied () const
const SgPointSetAll (SgBlackWhite color) const
const SgPointSetAllEmpty () const
const SgPointSetAllPoints () const
const SgPointSetCorners () const
 See SgBoardConst::Corners.
const SgPointSetEdges () const
 See SgBoardConst::Edges.
const SgPointSetCenters () const
 See SgBoardConst::Centers.
const SgPointSetSideExtensions () const
 See SgBoardConst::SideExtensions.
const SgPointSetLineSet (SgGrid line) const
 See SgBoardConst::LineSet.

Public Attributes

SgMarker m_userMarker
 Marker that can be used in client code.

Static Public Attributes

static const int MAX_KOLEVEL = 3
 Maximum number of immediate ko recaptures for GoBoard::m_koColor.

Private Member Functions

 GoBoard (const GoBoard &)
 Not implemented.
GoBoardoperator= (const GoBoard &)
 Not implemented.
bool CheckKo (SgBlackWhite player)
 Check if move violates Ko rule.
void AddLibToAdjBlocks (SgPoint p)
void AddLibToAdjBlocks (SgPoint p, SgBlackWhite c)
void AddStoneToBlock (SgPoint p, SgBlackWhite c, Block *block, StackEntry &entry)
BlockCreateNewBlock ()
void CreateSingleStoneBlock (SgPoint p, SgBlackWhite c)
SgArrayList< Block *, 4 > GetAdjacentBlocks (SgPoint p) const
SgArrayList< Block *, 4 > GetAdjacentBlocks (SgPoint p, SgBlackWhite c) const
void InitBlock (GoBoard::Block &block, SgBlackWhite c, SgPoint anchor)
bool IsAdjacentTo (SgPoint p, const Block *block) const
void MergeBlocks (SgPoint p, SgBlackWhite c, const SgArrayList< Block *, 4 > &adjBlocks)
void RemoveLibAndKill (SgPoint p, SgBlackWhite opp, StackEntry &entry)
 Remove liberty from adjacent blocks and kill opponent blocks without liberties.
void RemoveLibFromAdjBlocks (SgPoint p, SgBlackWhite c)
void RestoreKill (Block *block, SgBlackWhite c)
void UpdateBlocksAfterAddStone (SgPoint p, SgBlackWhite c, StackEntry &entry)
void UpdateBlocksAfterUndo (const StackEntry &entry)
void CheckConsistencyBlock (SgPoint p) const
bool FullBoardRepetition () const
bool CheckSuicide (SgPoint p, StackEntry &entry)
 Kill own block if no liberties.
void AddStone (SgPoint p, SgBlackWhite c)
void RemoveStone (SgPoint p)
void KillBlock (const Block *block)
bool HasLiberties (SgPoint p) const
void RestoreState (const StackEntry &entry)
 Restore state.
void SaveState (StackEntry &entry)
 Save state.

Static Private Member Functions

static bool IsPass (SgPoint p)
 Check if point is a pass move or a coupon move, which is handled like a pass move.

Private Attributes

State m_state
std::auto_ptr< Snapshotm_snapshot
uint64_t m_countPlay
 See CountPlay.
SgBoardConst m_const
 Data that's constant for this board size.
SgGrid m_size
 The current board size.
GoRules m_rules
 Rules for this board.
GoSetup m_setup
 Setup stones in the root position.
GoMoveInfo m_moveInfo
SgArrayList< Block,
GO_MAX_NUM_MOVES > * 
m_blockList
 Block data (stored in a stack).
SgMarker m_marker
GoPointList m_capturedStones
bool m_allowAnyRepetition
 Arbitrary repetition for both players.
bool m_allowKoRepetition
 Allow take-back of ko repetition.
bool m_koModifiesHash
SgEmptyBlackWhite m_koColor
SgEmptyBlackWhite m_koLoser
 m_koLoser can never become m_koColor.
SgArray< bool, SG_MAXPOINT > m_isBorder
SgArrayList< StackEntry,
GO_MAX_NUM_MOVES > * 
m_moves

Friends

class LibertyCopyIterator
class LibertyIterator
class StoneIterator

Detailed Description

Go board.

It maintains the state of each point when playing moves and taking them back. Setup stones are only supported in the initial position. It provides basic information about the board state, e.g. blocks and liberties. The actual storage representation and updating of stones and liberties is encapsulated, it can only be accessed with GoBoard::LibertyIterator, GoBoard::LibertyCopyIterator, and GoBoard::StoneIterator.

Boards are thread-safe (w.r.t. different instances) after construction (the constructor is not thread-safe, because it uses global variables via SgBoardConst).

See also:

Definition at line 93 of file GoBoard.h.


Constructor & Destructor Documentation

GoBoard::GoBoard ( int  size = GO_DEFAULT_SIZE,
const GoSetup setup = GoSetup(),
const GoRules rules = GoRules() 
) [explicit]

Definition at line 40 of file GoBoard.cpp.

References GoInitCheck(), and Init().

GoBoard::~GoBoard (  ) 

Definition at line 51 of file GoBoard.cpp.

References m_blockList, and m_moves.

GoBoard::GoBoard ( const GoBoard  )  [private]

Not implemented.


Member Function Documentation

void GoBoard::AddLibToAdjBlocks ( SgPoint  p  )  [private]
void GoBoard::AddLibToAdjBlocks ( SgPoint  p,
SgBlackWhite  c 
) [private]

Definition at line 174 of file GoBoard.cpp.

References GoBoard::Block::AppendLiberty(), GetAdjacentBlocks(), and NumNeighbors().

void GoBoard::AddStone ( SgPoint  p,
SgBlackWhite  c 
) [private]
void GoBoard::AddStoneToBlock ( SgPoint  p,
SgBlackWhite  c,
Block block,
StackEntry entry 
) [private]
int GoBoard::AdjacentBlocks ( SgPoint  p,
int  maxLib,
SgPoint  anchors[],
int  maxAnchors 
) const

Get adjacent opponent blocks with a maximum number of liberties for a given block.

Not defined for empty points.

Parameters:
p The block to check.
maxLib The maximum number of liberties of the neighbors.
anchors Resulting neighbor anchors and an additional END_POINT.
maxAnchors Array size of anchors (for detecting overflow in debug mode)
Returns:
Number of anchors (without the END_POINT)

Definition at line 543 of file GoBoard.cpp.

References Anchor(), AtMostNumLibs(), SgMarker::Clear(), GetStone(), IsColor(), m_marker, SgMarker::NewMark(), NumNeighbors(), Occupied(), SG_ASSERT, SG_DEBUG_ONLY, SG_ENDPOINT, SG_NS, SG_UNUSED(), SG_WE, and SgOppBW().

Referenced by GoBoardUtil::AdjacentBlocks().

const SgPointSet & GoBoard::All ( SgBlackWhite  color  )  const
const SgPointSet & GoBoard::AllEmpty (  )  const
void GoBoard::AllowAnyRepetition ( bool  allowAny  ) 
void GoBoard::AllowKoRepetition ( bool  allowKo  ) 
const SgPointSet & GoBoard::AllPoints (  )  const
SgPoint GoBoard::Anchor ( SgPoint  p  )  const
bool GoBoard::AnyRepetitionAllowed (  )  const

Are all repetition moves legal?

See also:
Handling of Ko Moves in Class GoBoard

Definition at line 1166 of file GoBoard.h.

References m_allowAnyRepetition.

Referenced by GoAssertBoardRestored::AssertRestored(), CheckKo(), GoAssertBoardRestored::Init(), and IsLegal().

bool GoBoard::AreInSameBlock ( SgPoint  stone1,
SgPoint  stone2 
) const

Return whether the two stones are located in the same block.

Return false if one of the stones is an empty or border point.

Definition at line 1171 of file GoBoard.h.

References Anchor(), and Occupied().

Referenced by GoLadder::PlayHunterMove().

bool GoBoard::AtLeastNumLibs ( SgPoint  block,
int  n 
) const

Return whether block has at least n liberties.

Definition at line 1176 of file GoBoard.h.

References NumLiberties().

bool GoBoard::AtMostNumLibs ( SgPoint  block,
int  n 
) const

Return whether block has at most n liberties.

Definition at line 1181 of file GoBoard.h.

References NumLiberties().

Referenced by AdjacentBlocks(), CanCapture(), GoBoardUtil::HasAdjacentBlocks(), InAtari(), NeighborBlocks(), and GoBoardUtil::SharedLibertyBlocks().

const SgBoardConst & GoBoard::BoardConst (  )  const

Definition at line 1226 of file GoBoard.h.

References m_const.

bool GoBoard::CanCapture ( SgPoint  p,
SgBlackWhite  c 
) const

Return whether playing colour c at p can capture anything, ignoring any possible repetition.

Definition at line 1337 of file GoBoard.h.

References AtMostNumLibs(), IsColor(), and SgOppBW().

Referenced by IsLegal().

bool GoBoard::CanUndo (  )  const

Whether there is any move to undo.

Definition at line 1186 of file GoBoard.h.

References SgArrayList< T, SIZE >::Length(), and m_moves.

Referenced by GoBoardUtil::UndoAll().

const GoPointList & GoBoard::CapturedStones (  )  const

The stones removed from the board by the most recent move.

Can be used for incremental update of other data structures. Includes captures and suicide stones. Only valid directly after a GoBoard::Play, otherwise undefined.

Definition at line 1191 of file GoBoard.h.

References m_capturedStones.

Referenced by GoBoardUtil::GetDirtyRegion(), and GoLadder::PlayPreyMove().

bool GoBoard::CapturingMove (  )  const

Whether the most recent move captured any stones.

Definition at line 1196 of file GoBoard.h.

References SgArrayList< T, SIZE >::IsEmpty(), and m_capturedStones.

Referenced by GoBoardUtil::GetDirtyRegion(), GoLadder::PlayHunterMove(), and GoLadder::PlayPreyMove().

const SgPointSet & GoBoard::Centers (  )  const

See SgBoardConst::Centers.

Definition at line 1201 of file GoBoard.h.

References SgBoardConst::Centers(), and m_const.

Referenced by InCenter(), and GoGtpEngine::WriteBoardInfo().

void GoBoard::CheckConsistency (  )  const

Checks whether all the board data structures are in a consistent state.

Definition at line 59 of file GoBoard.cpp.

References CheckConsistencyBlock(), IsBorder(), GoBoard::State::m_all, GoBoard::State::m_block, GoBoard::State::m_color, m_state, NumEmptyNeighbors(), NumNeighbors(), SG_ASSERT, SG_ASSERT_EBW, SG_BLACK, SG_EMPTY, SG_MAXPOINT, and SG_WHITE.

Referenced by Init(), Play(), RestoreSnapshot(), and Undo().

void GoBoard::CheckConsistencyBlock ( SgPoint  p  )  const [private]
bool GoBoard::CheckKo ( SgBlackWhite  player  )  [private]

Check if move violates Ko rule.

Sets isRepetition and updates m_koLevel, m_koColor and hash (if KoModifiesHash)

Returns:
false if isRepetition

Definition at line 136 of file GoBoard.cpp.

References AnyRepetitionAllowed(), FullBoardRepetition(), GO_MOVEFLAG_REPETITION, KoRepetitionAllowed(), GoBoard::State::m_hash, m_koColor, GoBoard::State::m_koLevel, m_koLoser, m_koModifiesHash, m_moveInfo, m_state, MAX_KOLEVEL, SG_EMPTY, SgOppBW(), and GoBoard::HashCode::XorWinKo().

Referenced by Play().

bool GoBoard::CheckSuicide ( SgPoint  p,
StackEntry entry 
) [private]

Kill own block if no liberties.

Sets isSuicide flag.

Returns:
false if move was suicide and suicide not allowed by current rules

Definition at line 739 of file GoBoard.cpp.

References GoRules::AllowSuicide(), GO_MOVEFLAG_SUICIDE, HasLiberties(), KillBlock(), GoBoard::State::m_block, m_moveInfo, m_rules, m_state, and GoBoard::StackEntry::m_suicide.

Referenced by Play().

const SgPointSet & GoBoard::Corners (  )  const

See SgBoardConst::Corners.

Definition at line 1206 of file GoBoard.h.

References SgBoardConst::Corners(), and m_const.

Referenced by InCorner(), and GoGtpEngine::WriteBoardInfo().

uint64_t GoBoard::CountPlay (  )  const
GoBoard::Block & GoBoard::CreateNewBlock (  )  [private]
void GoBoard::CreateSingleStoneBlock ( SgPoint  p,
SgBlackWhite  c 
) [private]
const SgPointSet & GoBoard::Edges (  )  const

See SgBoardConst::Edges.

Definition at line 1216 of file GoBoard.h.

References SgBoardConst::Edges(), and m_const.

Referenced by OnEdge(), and GoGtpEngine::WriteBoardInfo().

int GoBoard::FirstBoardPoint (  )  const
bool GoBoard::FullBoardRepetition (  )  const [private]
SgPoint GoBoard::Get2ndLastMove (  )  const

2nd Last move = last move by ToPlay().

Conditions similar to GetLastMove().

Definition at line 1231 of file GoBoard.h.

References GoBoard::StackEntry::m_color, GoBoard::StackEntry::m_point, MoveNumber(), SG_NULLMOVE, SgOppBW(), and ToPlay().

SgArrayList< GoBoard::Block *, 4 > GoBoard::GetAdjacentBlocks ( SgPoint  p,
SgBlackWhite  c 
) const [private]
SgArrayList< GoBoard::Block *, 4 > GoBoard::GetAdjacentBlocks ( SgPoint  p  )  const [private]
SgBoardColor GoBoard::GetColor ( SgPoint  p  )  const
const SgHashCode & GoBoard::GetHashCode (  )  const
SgHashCode GoBoard::GetHashCodeInclToPlay (  )  const

Return hash code for this position, modified by whose turn it is to play.

Note that GetHashCode() != GetHashCodeInclToPlay(), regardless of whose turn it is to play.

Definition at line 1254 of file GoBoard.h.

References GoBoard::HashCode::GetInclToPlay(), GoBoard::State::m_hash, m_state, and ToPlay().

Referenced by GoAutoBookState::ComputeHashCode(), GoSearch::GetHashCode(), GoBook::InsertEntry(), GoBook::LookupEntry(), GoAutoBookState::Play(), and GoGtpEngine::WriteBoardInfo().

SgPoint GoBoard::GetLastMove (  )  const

Return last move played.

Returns:
The last move played or SG_NULLMOVE, if
  • No move was played yet
  • The last move was not by the opposite color of the current player

Definition at line 1259 of file GoBoard.h.

References GoBoard::StackEntry::m_color, GoBoard::StackEntry::m_point, MoveNumber(), SG_NULLMOVE, SgOppBW(), and ToPlay().

Referenced by GoBoardUtil::TrompTaylorPassWins().

GoMoveInfo GoBoard::GetLastMoveInfo (  )  const

Definition at line 1270 of file GoBoard.h.

References m_moveInfo.

Referenced by GoGtpEngine::CheckLegal().

SgBlackWhite GoBoard::GetStone ( SgPoint  p  )  const
bool GoBoard::HasDiagonals ( SgPoint  p,
SgBoardColor  c 
) const

Definition at line 1281 of file GoBoard.h.

References IsColor(), SG_NS, and SG_WE.

Referenced by HasNeighborsOrDiags(), and GoEyeUtil::IsSinglePointEye().

bool GoBoard::HasEmptyNeighbors ( SgPoint  p  )  const
bool GoBoard::HasLiberties ( SgPoint  p  )  const [private]

Definition at line 1294 of file GoBoard.h.

References NumLiberties().

Referenced by CheckSuicide().

bool GoBoard::HasNeighbors ( SgPoint  p,
SgBlackWhite  c 
) const
bool GoBoard::HasNeighborsOrDiags ( SgPoint  p,
SgBlackWhite  c 
) const

Definition at line 1304 of file GoBoard.h.

References HasDiagonals(), and HasNeighbors().

bool GoBoard::InAtari ( SgPoint  p  )  const
bool GoBoard::InCenter ( SgPoint  p  )  const

Definition at line 1346 of file GoBoard.h.

References Centers().

Referenced by GoGtpEngine::CmdPointInfo().

bool GoBoard::InCorner ( SgPoint  p  )  const

Definition at line 1351 of file GoBoard.h.

References Corners().

Referenced by GoGtpEngine::CmdPointInfo().

void GoBoard::Init ( int  size,
const GoRules rules,
const GoSetup setup = GoSetup() 
)
void GoBoard::Init ( int  size,
const GoSetup setup = GoSetup() 
)
void GoBoard::InitBlock ( GoBoard::Block block,
SgBlackWhite  c,
SgPoint  anchor 
) [private]
bool GoBoard::IsAdjacentTo ( SgPoint  p,
const Block block 
) const [private]

Definition at line 289 of file GoBoard.cpp.

References GoBoard::State::m_block, m_state, SG_NS, and SG_WE.

Referenced by AddStoneToBlock().

bool GoBoard::IsBorder ( SgPoint  p  )  const
bool GoBoard::IsColor ( SgPoint  p,
int  c 
) const
bool GoBoard::IsEmpty ( SgPoint  p  )  const
bool GoBoard::IsFirst ( SgPoint  p  )  const

Check if move at point would be the first move there.

Definition at line 1398 of file GoBoard.h.

References IsEmpty(), GoBoard::State::m_isFirst, m_state, and SG_ASSERT.

Referenced by GoGtpEngine::CmdPointInfo(), IsLegal(), and Play().

bool GoBoard::IsInBlock ( SgPoint  p,
SgPoint  anchor 
) const

Efficient combined test if point is occupied and belongs to a block.

Returns:
true, if point is occupied and belongs to the block with the given anchor.

Definition at line 1315 of file GoBoard.h.

References GoBoard::Block::Anchor(), Anchor(), GoBoard::State::m_block, m_state, Occupied(), and SG_ASSERT.

bool GoBoard::IsLegal ( int  p,
SgBlackWhite  player 
) const

Check whether the move at 'p' is legal.

Since it's not clear how 'p' was arrived at, any value of 'p' is admissible, even out of point range and on border points; just return false on such input. LastMoveInfo is guaranteed to be vaild after this call. Suicide moves are only legal, if SetSelfRemovalAllowed(true) was called.

Definition at line 1404 of file GoBoard.h.

References AnyRepetitionAllowed(), CanCapture(), GO_MOVEFLAG_ILLEGAL, SgPointUtil::InBoardRange(), IsEmpty(), IsFirst(), IsNewPosition(), IsPass(), IsSuicide(), KoRepetitionAllowed(), LastMoveInfo(), GoBoard::State::m_koPoint, m_state, GoBoard::State::m_toPlay, Play(), Rules(), SG_ASSERT, SG_ASSERT_BW, GoRules::SIMPLEKO, and Undo().

Referenced by GoBook::Add(), GoBook::Entry::ApplyTo(), GoGtpEngine::CmdPointInfo(), GoAutoBook::ExportToOldFormat(), GoAutoBook::FindBestChild(), GoBoardUtil::GenerateIfLegal(), GoBook::InsertEntry(), IsLegal(), GoBook::LookupAllMoves(), GoBookCommands::PositionInfo(), GoEyeUtil::TestNakade(), and GoAutoBook::TruncateByDepth().

bool GoBoard::IsLegal ( int  p  )  const

Check whether the move at 'p' is legal for color to play.

See also:
IsLegal(int, SgBlackWhite).

Definition at line 1439 of file GoBoard.h.

References IsLegal(), and ToPlay().

bool GoBoard::IsLibertyOfBlock ( SgPoint  p,
SgPoint  anchor 
) const

Check if empty point is a liberty of block.

Parameters:
p The point the check.
anchor The anchor of the block.
Returns:
true If point is liberty of block.

Definition at line 1323 of file GoBoard.h.

References Anchor(), GoBoard::Block::Color(), IsEmpty(), GoBoard::State::m_block, GoBoard::State::m_nuNeighbors, m_state, Occupied(), SG_ASSERT, SG_NS, and SG_WE.

Referenced by GoBlock::AllEmptyAreLiberties(), GoBoardUtil::AtLeastTwoSharedLibs(), GoBlock::HasLiberty(), and GoBoardUtil::SharedLiberties().

bool GoBoard::IsNewPosition (  )  const

Check if board is in a definitely new situation, with no possibility of repetition.

Definition at line 1434 of file GoBoard.h.

References GoBoard::State::m_isNewPosition, and m_state.

Referenced by IsLegal(), and Play().

bool GoBoard::IsPass ( SgPoint  p  )  [static, private]

Check if point is a pass move or a coupon move, which is handled like a pass move.

Definition at line 1446 of file GoBoard.h.

References SgMoveUtil::IsCouponMove(), and SG_PASS.

Referenced by FullBoardRepetition(), IsLegal(), Play(), RestoreState(), SaveState(), and UpdateBlocksAfterUndo().

bool GoBoard::IsSingleStone ( SgPoint  p  )  const

Return NumStones(p) == 1.

Definition at line 1451 of file GoBoard.h.

References GetColor(), NumNeighbors(), and Occupied().

Referenced by GoGtpEngine::CmdPointInfo(), GoLadder::IsSnapback(), GoBoardUtil::IsSnapback(), and GoBoardUtil::Stones().

bool GoBoard::IsSuicide ( SgPoint  p  )  const

Definition at line 1456 of file GoBoard.h.

References IsSuicide(), and ToPlay().

bool GoBoard::IsSuicide ( SgPoint  p,
SgBlackWhite  toPlay 
) const
bool GoBoard::IsValidPoint ( SgPoint  p  )  const
void GoBoard::KillBlock ( const Block block  )  [private]
SgEmptyBlackWhite GoBoard::KoColor (  )  const

Player who has immediately retaken a ko.

It is SG_EMPTY if no player has done it.

Definition at line 1466 of file GoBoard.h.

References m_koColor.

Referenced by GoAssertBoardRestored::AssertRestored(), GoAssertBoardRestored::Init(), and GoGtpEngine::WriteBoardInfo().

int GoBoard::KoLevel (  )  const

Number of times that KoColor has immediately retaken a ko.

Definition at line 1471 of file GoBoard.h.

References GoBoard::State::m_koLevel, and m_state.

Referenced by GoAssertBoardRestored::AssertRestored(), GoAssertBoardRestored::Init(), and SetKoLoser().

SgEmptyBlackWhite GoBoard::KoLoser (  )  const

Player who will lose any ko.

KoLoser is a player who is a priori determined to lose ko fights. therefore he is never allowed to become 'KoColor' If KoLoser is empty, no such prior bias is assumed.

Definition at line 1476 of file GoBoard.h.

References m_koLoser.

Referenced by GoAssertBoardRestored::AssertRestored(), and GoAssertBoardRestored::Init().

bool GoBoard::KoModifiesHash (  )  const

Definition at line 1481 of file GoBoard.h.

References m_koModifiesHash.

Referenced by GoAssertBoardRestored::AssertRestored(), and GoAssertBoardRestored::Init().

SgPoint GoBoard::KoPoint (  )  const

Point which is currently illegal due to simple ko rule.

Note that there could be more points illegal if superko rules are used.

Returns:
The ko point or SG_NULLPOINT, if none exists.

Definition at line 1486 of file GoBoard.h.

References GoBoard::State::m_koPoint, and m_state.

bool GoBoard::KoRepetitionAllowed (  )  const
int GoBoard::LastBoardPoint (  )  const
bool GoBoard::LastMoveInfo ( GoMoveInfoFlag  flag  )  const

Information about the most recent call to Play.

Guaranteed to be valid only directly after a call to Play.

See also:
GoMoveInfoFlag

Definition at line 1501 of file GoBoard.h.

References m_moveInfo.

Referenced by IsLegal(), GoLadderUtil::IsProtectedLiberty(), GoRegionBoard::OnExecutedUncodedMove(), and GoBoardUtil::PlayIfLegal().

int GoBoard::Left ( SgPoint  p  )  const

Returns the offset along left side of the board.

Left and right are as seen from the edge toward the center of the board. Returns zero for the same points as Up does.

Definition at line 1506 of file GoBoard.h.

References SgBoardConst::Left(), and m_const.

SgGrid GoBoard::Line ( SgPoint  p  )  const
const SgPointSet & GoBoard::LineSet ( SgGrid  line  )  const

See SgBoardConst::LineSet.

Definition at line 1516 of file GoBoard.h.

References SgBoardConst::LineSet(), and m_const.

Referenced by GoBoardUtil::Lines().

void GoBoard::MergeBlocks ( SgPoint  p,
SgBlackWhite  c,
const SgArrayList< Block *, 4 > &  adjBlocks 
) [private]
GoPlayerMove GoBoard::Move ( int  i  )  const
int GoBoard::MoveNumber (  )  const
void GoBoard::NeighborBlocks ( SgPoint  p,
SgBlackWhite  c,
SgPoint  anchors[] 
) const

List anchor of each block of color 'c' adjacent to the empty point 'p'.

Assert if 'p' is not empty. Fill an array of points, terminated by END_POINT.

Definition at line 582 of file GoBoard.cpp.

References Anchor(), SgMarker::Clear(), IsColor(), IsEmpty(), m_marker, SgMarker::NewMark(), NumNeighbors(), SG_ASSERT, SG_ENDPOINT, SG_NS, SG_UNUSED(), and SG_WE.

Referenced by GoNeighborBlockIterator::GoNeighborBlockIterator().

void GoBoard::NeighborBlocks ( SgPoint  p,
SgBlackWhite  c,
int  maxLib,
SgPoint  anchors[] 
) const

List anchor of each block of color 'c' with at most 'maxLib' liberties adjacent to the empty point 'p'.

Assert if 'p' is not empty. Fill an array of points, terminated by END_POINT.

Definition at line 604 of file GoBoard.cpp.

References Anchor(), AtMostNumLibs(), SgMarker::Clear(), IsColor(), IsEmpty(), m_marker, SgMarker::NewMark(), NumNeighbors(), SG_ASSERT, SG_ENDPOINT, SG_NS, SG_UNUSED(), and SG_WE.

int GoBoard::NuCapturedStones (  )  const

The stones captured by the most recent move.

See also:
CapturedStones

Definition at line 1536 of file GoBoard.h.

References SgArrayList< T, SIZE >::Length(), and m_capturedStones.

int GoBoard::Num8EmptyNeighbors ( SgPoint  p  )  const

Includes diagonals.

Definition at line 1531 of file GoBoard.h.

References NumEmptyDiagonals(), and NumEmptyNeighbors().

Referenced by GoGtpEngine::CmdPointInfo(), GoEyeUtil::IsPossibleEye(), and GoEyeUtil::NumberOfMoveToEye().

int GoBoard::Num8Neighbors ( SgPoint  p,
SgBlackWhite  c 
) const

Includes diagonals.

Definition at line 1526 of file GoBoard.h.

References NumDiagonals(), and NumNeighbors().

Referenced by GoEyeUtil::IsPossibleEye(), and GoEyeUtil::NumberOfMoveToEye().

int GoBoard::NumDiagonals ( SgPoint  p,
SgBoardColor  c 
) const
int GoBoard::NumEmptyDiagonals ( SgPoint  p  )  const

Definition at line 1555 of file GoBoard.h.

References NumDiagonals(), and SG_EMPTY.

Referenced by GoEyeUtil::IsPossibleEye(), and Num8EmptyNeighbors().

int GoBoard::NumEmptyNeighbors ( SgPoint  p  )  const
int GoBoard::NumLiberties ( SgPoint  p  )  const
int GoBoard::NumNeighbors ( SgPoint  p,
SgBlackWhite  c 
) const
int GoBoard::NumPrisoners ( SgBlackWhite  color  )  const

The total number of stones of 'color' that have been captured by the opponent throughout the game.

Definition at line 1577 of file GoBoard.h.

References GoBoard::State::m_prisoners, and m_state.

Referenced by GoBoardUtil::ScorePosition().

int GoBoard::NumStones ( SgPoint  p  )  const

Return the number of stones in the block at 'p'.

Not defined for empty or border points.

Definition at line 1582 of file GoBoard.h.

References GoBoard::State::m_block, m_state, Occupied(), and SG_ASSERT.

Referenced by CheckConsistencyBlock(), GoGtpEngine::CmdPointInfo(), GoLadderUtil::IsProtectedLiberty(), and Play().

bool GoBoard::Occupied ( SgPoint  p  )  const
SgPointSet GoBoard::Occupied (  )  const
bool GoBoard::OccupiedInAtari ( SgPoint  p  )  const

Check if point is occupied and in atari.

Faster than Occupied(p) || InAtari(p). May be called for border points.

Definition at line 1598 of file GoBoard.h.

References GoBoard::State::m_block, m_state, and GoBoard::Block::NumLiberties().

bool GoBoard::OnEdge ( SgPoint  p  )  const

Definition at line 1604 of file GoBoard.h.

References Edges().

Referenced by GoGtpEngine::CmdPointInfo().

GoBoard& GoBoard::operator= ( const GoBoard  )  [private]

Not implemented.

SgBlackWhite GoBoard::Opponent (  )  const

Opponent of player whose turn it is to play.

Definition at line 1609 of file GoBoard.h.

References m_state, GoBoard::State::m_toPlay, and SgOppBW().

void GoBoard::Play ( GoPlayerMove  move  ) 

Play a move.

See also:
Play(SgPoint,SgBlackWhite);

Definition at line 1614 of file GoBoard.h.

References GoPlayerMove::Color(), Play(), and GoPlayerMove::Point().

void GoBoard::Play ( SgPoint  p,
SgBlackWhite  player 
)

Play a move.

Move needs to be SG_PASS or on-board empty point. If move is not legal according to the current GoRules, the move flag isIllegal will be set. After playing the color to play ys the opposite color of the color of the move.

Definition at line 751 of file GoBoard.cpp.

References AddStone(), CheckConsistency(), CheckKo(), CheckSuicide(), SgArrayList< T, SIZE >::Clear(), GO_MOVEFLAG_CAPTURING, GO_MOVEFLAG_ILLEGAL, SgArrayList< T, SIZE >::IsEmpty(), IsEmpty(), IsFirst(), IsNewPosition(), IsPass(), IsValidPoint(), SgArrayList< T, SIZE >::Last(), SgArrayList< T, SIZE >::Length(), m_capturedStones, GoBoard::StackEntry::m_color, m_countPlay, GoBoard::State::m_hash, GoBoard::State::m_isFirst, GoBoard::State::m_isNewPosition, GoBoard::StackEntry::m_killed, m_koModifiesHash, GoBoard::State::m_koPoint, m_moveInfo, m_moves, GoBoard::State::m_numStones, GoBoard::StackEntry::m_point, m_state, GoBoard::StackEntry::m_suicide, GoBoard::State::m_toPlay, MoveNumber(), NumLiberties(), NumStones(), RemoveLibAndKill(), SgArrayList< T, SIZE >::Resize(), SaveState(), SG_ASSERT, SG_ASSERT_BW, SG_NULLMOVE, SG_NULLPOINT, SgOppBW(), UpdateBlocksAfterAddStone(), GoBoard::HashCode::XorCaptured(), and GoBoard::HashCode::XorStone().

Referenced by GoBoardUtil::AddWall(), GoBook::Entry::ApplyTo(), GoGtpEngine::CheckLegal(), GoGtpEngine::CmdPlaceFreeHandicap(), GoBoardSynchronizer::ExecuteSubscriber(), GoLadder::HunterLadder(), GoBook::InsertEntry(), IsLegal(), Play(), GoBoardUtil::PlayIfLegal(), GoBookCommands::PositionInfo(), GoAutoBookState::Synchronize(), GoBoardUpdater::Update(), and GoBoardRestorer::~GoBoardRestorer().

void GoBoard::Play ( SgPoint  p  ) 

Play a move for the current player.

See also:
Play(SgPoint,SgBlackWhite);

Definition at line 1619 of file GoBoard.h.

References Play(), and ToPlay().

SgGrid GoBoard::Pos ( SgPoint  p  )  const

See SgBoardConst::Pos.

Definition at line 1624 of file GoBoard.h.

References m_const, and SgBoardConst::Pos().

Referenced by GoGtpEngine::CmdPointInfo(), and GoEyeUtil::IsPossibleEye().

void GoBoard::RemoveLibAndKill ( SgPoint  p,
SgBlackWhite  opp,
StackEntry entry 
) [private]
void GoBoard::RemoveLibFromAdjBlocks ( SgPoint  p,
SgBlackWhite  c 
) [private]

Definition at line 332 of file GoBoard.cpp.

References GetAdjacentBlocks(), and NumNeighbors().

Referenced by RestoreKill().

void GoBoard::RemoveStone ( SgPoint  p  )  [private]
void GoBoard::RestoreKill ( Block block,
SgBlackWhite  c 
) [private]
void GoBoard::RestoreSnapshot (  ) 

Restore a snapshot.

Can only be called, if previously TakeSnapshot() was called and the current position is a followup position of the snapshot position. RestoreSnapshot() can used multiple times for the same snapshot.

See also:
TakeSnapshot()

Definition at line 889 of file GoBoard.cpp.

References CheckConsistency(), GoBoard::State::m_block, m_blockList, m_moves, m_snapshot, m_state, MoveNumber(), SgArrayList< T, SIZE >::Resize(), and SG_ASSERT.

void GoBoard::RestoreState ( const StackEntry entry  )  [private]
int GoBoard::Right ( SgPoint  p  )  const

Returns the offset along right side of the board.

See also:
Left for more info.

Definition at line 1629 of file GoBoard.h.

References m_const, and SgBoardConst::Right().

GoRules & GoBoard::Rules (  ) 
const GoRules & GoBoard::Rules (  )  const

Current game rules.

Definition at line 1639 of file GoBoard.h.

References m_rules.

void GoBoard::SaveState ( StackEntry entry  )  [private]
void GoBoard::SetKoLoser ( SgEmptyBlackWhite  color  ) 

See KoLoser.

Definition at line 1644 of file GoBoard.h.

References KoLevel(), m_koLoser, and SG_ASSERT.

void GoBoard::SetKoModifiesHash ( bool  modify  ) 

Enable modification of hash code by Ko moves.

Can be used if Ko repetition is allowed.

Warning:
You have to disable it in the same position, where it was enabled, otherwise the incremental update of the hash code does not work; use KoHashModifier in GoBoardUtil to do this automatically.

Definition at line 1650 of file GoBoard.h.

References m_koModifiesHash.

void GoBoard::SetToPlay ( SgBlackWhite  player  ) 
const GoSetup & GoBoard::Setup (  )  const

Setup information of the first position.

Definition at line 1661 of file GoBoard.h.

References m_setup.

Referenced by GoBoardUtil::DumpBoard(), GoBoardHistory::SetFromBoard(), GoBoardSynchronizer::UpdateFromInit(), and GoBoardSynchronizer::UpdateSubscriber().

int GoBoard::Side ( SgPoint  p,
int  index 
) const

Same as Left/Right, but the side is passed in as an index (0 or 1).

Definition at line 1666 of file GoBoard.h.

References m_const, and SgBoardConst::Side().

const SgPointSet & GoBoard::SideExtensions (  )  const

See SgBoardConst::SideExtensions.

Definition at line 1671 of file GoBoard.h.

References m_const, and SgBoardConst::SideExtensions().

Referenced by GoGtpEngine::WriteBoardInfo().

SgGrid GoBoard::Size (  )  const

Return the size of this board.

Definition at line 1676 of file GoBoard.h.

References m_size.

Referenced by GoBook::Add(), GoSafetyUtil::AddToSafe(), GoRegion::AllInsideLibs(), AllPoints(), GoBook::Entry::ApplyTo(), GoAssertBoardRestored::AssertRestored(), GoRegion::CheckConsistency(), GoRegionBoard::Clear(), GoGtpExtraCommands::CmdCfgDistance(), GoGtpEngine::CmdFixedHandicap(), GoGtpEngine::CmdListStones(), GoGtpEngine::CmdPlaceFreeHandicap(), GoGtpEngine::CmdPointNumbers(), GoBook::Delete(), GoRegion::Dep(), GoBoardUtil::DumpBoard(), GoBoardUtil::ExpandToBlocks(), GoAutoBook::ExportToOldFormat(), GoSafetyUtil::ExtendedIsTerritory(), GoSafetyUtil::ExtendedMightMakeLife(), GoRegion::Find2ConnForAllInterior(), GoRegion::FindBlocks(), GoRegion::FindChains(), GoSafetyUtil::FindDameAndUnsurroundablePoints(), GoInfluence::FindInfluence(), GoRegionBoard::GetBlock(), GoBoardUtil::GetCoordString(), GoRegionUtil::Has2SureLiberties(), GoAssertBoardRestored::Init(), GoGame::InitHandicap(), GoBook::InsertEntry(), GoStaticLadder::IsEdgeLadder(), GoRegionUtil::IsSingleBlock(), GoRegionUtil::IsSmallRegion(), GoRegion::IsSurrounded(), GoSafetyUtil::IsTerritory(), GoBlock::Liberties(), GoBoardUtil::Lines(), GoBook::LookupEntry(), GoRegionBoard::MergeAdjacentAndAddBlock(), GoSafetyUtil::MightMakeLife(), operator<<(), GoRegion::ProtectedCuts(), GoRegionBoard::RemoveBlock(), GoGtpCommandUtil::RespondNumberArray(), GoRegion::Safe2Cuts(), GoRegion::SetBlocks(), GoBoardHistory::SetFromBoard(), GoAutoBookState::Synchronize(), GoEyeUtil::TestNakade(), TotalNumEmpty(), GoBoardUpdater::Update(), GoRegionBoard::UpdateBlock(), GoBoardSynchronizer::UpdateFromInit(), GoBoardSynchronizer::UpdateSubscriber(), GoRegionBoard::UpToDate(), GoSafetyUtil::WriteStatistics(), and GoBoardRestorer::~GoBoardRestorer().

bool GoBoard::StackOverflowLikely (  )  const

Check if sufficient space on internal stacks.

Should be checked before executing a move. If the internal stacks overflow, assertions will (hopefully) trigger in debug mode, but undefined behaviour occurs in release mode.

Definition at line 538 of file GoBoard.cpp.

References GO_MAX_NUM_MOVES, and MoveNumber().

void GoBoard::TakeSnapshot (  ) 

Remember current position for quickly undoing a sequence of moves.

Note that for short sequences of moves this can take longer than incrementally restoring the state by multiple calls to Undo().

Definition at line 876 of file GoBoard.cpp.

References SgArrayList< T, SIZE >::Length(), GoBoard::State::m_block, m_blockList, m_snapshot, m_state, and MoveNumber().

SgPoint GoBoard::TheLiberty ( SgPoint  blockInAtari  )  const

Return the liberty of 'blockInAtari' which must have exactly one liberty.

Definition at line 1681 of file GoBoard.h.

References GoBoard::State::m_block, m_state, NumLiberties(), Occupied(), and SG_ASSERT.

Referenced by GoStaticLadder::IsEdgeLadder(), GoLadderUtil::IsProtectedLiberty(), and GoBoardUtil::IsSnapback().

SgBlackWhite GoBoard::ToPlay (  )  const
int GoBoard::TotalNumEmpty (  )  const

Number of empty points currently on the board.

Definition at line 1693 of file GoBoard.h.

References GoBoard::State::m_numStones, m_state, SG_BLACK, SG_WHITE, and Size().

Referenced by GoTimeControl::GetPositionInfo(), GoRegionUtil::IsSingleBlock(), and GoGtpEngine::WriteBoardInfo().

const SgBWArray< int > & GoBoard::TotalNumStones (  )  const
int GoBoard::TotalNumStones ( SgBlackWhite  color  )  const

Definition at line 1704 of file GoBoard.h.

References GoBoard::State::m_numStones, and m_state.

void GoBoard::Undo (  ) 
int GoBoard::Up ( SgPoint  p  )  const

Returns the offset to the point on the line above this point.

Returns zero for points outside the board, and for the center point(s).

Definition at line 1709 of file GoBoard.h.

References m_const, and SgBoardConst::Up().

void GoBoard::UpdateBlocksAfterAddStone ( SgPoint  p,
SgBlackWhite  c,
StackEntry entry 
) [private]
void GoBoard::UpdateBlocksAfterUndo ( const StackEntry entry  )  [private]

Friends And Related Function Documentation

friend class LibertyCopyIterator [friend]

Definition at line 869 of file GoBoard.h.

friend class LibertyIterator [friend]

Definition at line 870 of file GoBoard.h.

friend class StoneIterator [friend]

Definition at line 871 of file GoBoard.h.


Member Data Documentation

Arbitrary repetition for both players.

Definition at line 780 of file GoBoard.h.

Referenced by AllowAnyRepetition(), AnyRepetitionAllowed(), and Init().

Allow take-back of ko repetition.

Definition at line 783 of file GoBoard.h.

Referenced by AllowKoRepetition(), Init(), and KoRepetitionAllowed().

Block data (stored in a stack).

Maximum number: A move can create zero or one new block.

Definition at line 769 of file GoBoard.h.

Referenced by CreateNewBlock(), Init(), RestoreSnapshot(), TakeSnapshot(), UpdateBlocksAfterUndo(), and ~GoBoard().

Definition at line 777 of file GoBoard.h.

Referenced by CapturedStones(), CapturingMove(), KillBlock(), NuCapturedStones(), and Play().

Data that's constant for this board size.

Definition at line 753 of file GoBoard.h.

Referenced by BoardConst(), Centers(), Corners(), Edges(), FirstBoardPoint(), Init(), LastBoardPoint(), Left(), Line(), LineSet(), Pos(), Right(), Side(), SideExtensions(), and Up().

uint64_t GoBoard::m_countPlay [private]

See CountPlay.

Definition at line 750 of file GoBoard.h.

Referenced by CountPlay(), Init(), and Play().

SgArray<bool,SG_MAXPOINT> GoBoard::m_isBorder [private]

Definition at line 792 of file GoBoard.h.

Referenced by Init(), InitBlock(), and IsBorder().

Definition at line 787 of file GoBoard.h.

Referenced by CheckKo(), Init(), KoColor(), RestoreState(), and SaveState().

m_koLoser can never become m_koColor.

Definition at line 790 of file GoBoard.h.

Referenced by CheckKo(), Init(), KoLoser(), RestoreState(), SaveState(), and SetKoLoser().

bool GoBoard::m_koModifiesHash [private]

Definition at line 785 of file GoBoard.h.

Referenced by CheckKo(), Init(), KoModifiesHash(), Play(), RestoreState(), SaveState(), and SetKoModifiesHash().

SgMarker GoBoard::m_marker [mutable, private]

Definition at line 775 of file GoBoard.h.

Referenced by AdjacentBlocks(), InitBlock(), MergeBlocks(), and NeighborBlocks().

Definition at line 765 of file GoBoard.h.

Referenced by CheckKo(), CheckSuicide(), GetLastMoveInfo(), LastMoveInfo(), and Play().

Rules for this board.

Can be modified anytime with GoBoard::Rules()

Definition at line 760 of file GoBoard.h.

Referenced by CheckSuicide(), Init(), and Rules().

Setup stones in the root position.

Definition at line 763 of file GoBoard.h.

Referenced by Init(), and Setup().

The current board size.

Definition at line 756 of file GoBoard.h.

Referenced by Init(), and Size().

std::auto_ptr<Snapshot> GoBoard::m_snapshot [private]

Definition at line 747 of file GoBoard.h.

Referenced by Init(), RestoreSnapshot(), and TakeSnapshot().

Marker that can be used in client code.

This marker is never used by this class, it is intended for external functions that operate on the board and can profit from the fast clear operation of SgMarker (if reused), but cannot store its own marker (or don't want to use a global variable for thread-safety). Since only one function can use this marker at a time, you should assert with SgReserveMarker that the marker is not used in a conflicting way.

Definition at line 109 of file GoBoard.h.

Referenced by GoBoardUtil::AdjacentStones(), GoBoardUtil::BlocksAdjacentToPoints(), and GoBoardUtil::SharedLibertyBlocks().

const int GoBoard::MAX_KOLEVEL = 3 [static]

Maximum number of immediate ko recaptures for GoBoard::m_koColor.

Enforced only if ko modifies hash

See also:
KoModifiesHash()

Definition at line 99 of file GoBoard.h.

Referenced by CheckKo(), and GoBoard::HashCode::XorWinKo().


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


Sun Mar 13 2011 Doxygen 1.7.1