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

GoUctBoard Class Reference

Go board optimized for Monte-Carlo. More...

#include <GoUctBoard.h>

List of all members.

Classes

struct  Block
 Data related to a block of stones on the board. More...
class  Iterator
 Iterate through all points on the given board. More...
class  LibertyIterator
 Iterate through all the liberties of a block. More...
class  StoneIterator
 Iterate through all the stones of a block. More...

Public Member Functions

 GoUctBoard (const GoBoard &bd)
 ~GoUctBoard ()
const SgBoardConstBoardConst () const
void Init (const GoBoard &bd)
 Re-initializes the board from GoBoard position.
SgGrid Size () const
 Return the size of this board.
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.
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.
void Play (SgPoint p)
 Play a move for the current player.
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.
SgPoint GetLastMove () const
 Return last move played.
SgPoint Get2ndLastMove () const
 2nd Last move = last move by ToPlay().
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 a reference point in the block at a point.
bool IsInBlock (SgPoint p, SgPoint anchor) const
 See GoBoard::IsInBlock.
bool IsLibertyOfBlock (SgPoint p, SgPoint anchor) const
 See GoBoard::IsLibertyOfBlock.
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'.
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.
void CheckConsistency () const
 Checks whether all the board data structures are in a consistent state.

Public Attributes

SgMarker m_userMarker
 Marker that can be used in client code.

Private Member Functions

 GoUctBoard (const GoUctBoard &)
 Not implemented.
GoUctBoardoperator= (const GoUctBoard &)
 Not implemented.
void AddLibToAdjBlocks (SgPoint p, SgBlackWhite c)
void AddStoneToBlock (SgPoint p, Block *block)
void CreateSingleStoneBlock (SgPoint p, SgBlackWhite c)
void InitSize (const GoBoard &bd)
bool IsAdjacentTo (SgPoint p, const Block *block) const
void MergeBlocks (SgPoint p, const SgArrayList< Block *, 4 > &adjBlocks)
void RemoveLibAndKill (SgPoint p, SgBlackWhite opp, SgArrayList< Block *, 4 > &ownAdjBlocks)
 Remove liberty from adjacent blocks and kill opponent blocks without liberties.
void UpdateBlocksAfterAddStone (SgPoint p, SgBlackWhite c, const SgArrayList< Block *, 4 > &adjBlocks)
void CheckConsistencyBlock (SgPoint p) const
bool FullBoardRepetition () const
void AddStone (SgPoint p, SgBlackWhite c)
void KillBlock (const Block *block)
bool HasLiberties (SgPoint p) const

Private Attributes

SgPoint m_lastMove
SgPoint m_secondLastMove
SgPoint m_koPoint
 Point which is currently illegal for simple Ko rule.
SgBlackWhite m_toPlay
 Whose turn it is to play.
SgArray< Block *, SG_MAXPOINT > m_block
SgBWArray< int > m_prisoners
 Number of prisoners of each color.
SgArray< int, SG_MAXPOINT > m_color
 The current board position.
SgArray< int, SG_MAXPOINT > m_nuNeighborsEmpty
 Number of black and white neighbors.
SgBWArray< SgArray< int,
SG_MAXPOINT > > 
m_nuNeighbors
 Number of black and white neighbors.
SgBoardConst m_const
 Data that's constant for this board size.
SgGrid m_size
 The current board size.
SgPointArray< Blockm_blockArray
SgMarker m_marker
SgMarker m_marker2
GoPointList m_capturedStones
SgArray< bool, SG_MAXPOINT > m_isBorder

Friends

class LibertyIterator
class StoneIterator

Detailed Description

Go board optimized for Monte-Carlo.

In contrast to class GoBoard, this board makes certain assumptions that are usually true for Monte-Carlo simulations for better efficiency:

Otherwise, the member functions are named like in class GoBoard to allow writing utility functions that use the board class as a template parameter (as long as they use only the functionality shared by both board classes)

Definition at line 40 of file GoUctBoard.h.


Constructor & Destructor Documentation

GoUctBoard::GoUctBoard ( const GoBoard bd  )  [explicit]

Definition at line 32 of file GoUctBoard.cpp.

References Init(), and m_size.

GoUctBoard::~GoUctBoard (  ) 

Definition at line 39 of file GoUctBoard.cpp.

GoUctBoard::GoUctBoard ( const GoUctBoard  )  [private]

Not implemented.


Member Function Documentation

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

Definition at line 320 of file GoUctBoard.cpp.

References IsEmpty(), m_color, m_nuNeighbors, m_nuNeighborsEmpty, SG_ASSERT, SG_ASSERT_BW, SG_NS, and SG_WE.

Referenced by Play().

void GoUctBoard::AddStoneToBlock ( SgPoint  p,
Block block 
) [private]
int GoUctBoard::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 514 of file GoUctBoard.h.

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

SgPoint GoUctBoard::Anchor ( SgPoint  p  )  const

Return a reference point in the block at a point.

Note:
In contrast to GoBoard, the anchor point is not guaranteed to be the smallest point (this functionality is not needed in Monte-Carlo) Requires: Occupied(p).

Definition at line 553 of file GoUctBoard.h.

References m_block, Occupied(), and SG_ASSERT.

Referenced by AdjacentBlocks(), AreInSameBlock(), IsLibertyOfBlock(), and NeighborBlocks().

bool GoUctBoard::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 559 of file GoUctBoard.h.

References Anchor(), and Occupied().

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

Return whether block has at least n liberties.

Definition at line 564 of file GoUctBoard.h.

References NumLiberties().

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

Return whether block has at most n liberties.

Definition at line 569 of file GoUctBoard.h.

References NumLiberties().

Referenced by AdjacentBlocks(), CanCapture(), InAtari(), and NeighborBlocks().

const SgBoardConst & GoUctBoard::BoardConst (  )  const

Definition at line 589 of file GoUctBoard.h.

References m_const.

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

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

Definition at line 670 of file GoUctBoard.h.

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

const GoPointList & GoUctBoard::CapturedStones (  )  const

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

Can be used for incremental update of other data structures. Only valid directly after a GoUctBoard::Play, otherwise undefined.

Definition at line 574 of file GoUctBoard.h.

References m_capturedStones.

bool GoUctBoard::CapturingMove (  )  const

Whether the most recent move captured any stones.

Definition at line 579 of file GoUctBoard.h.

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

void GoUctBoard::CheckConsistency (  )  const

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

Definition at line 43 of file GoUctBoard.cpp.

References CheckConsistencyBlock(), IsBorder(), m_block, m_color, NumEmptyNeighbors(), NumNeighbors(), SG_ASSERT, SG_ASSERT_EBW, SG_BLACK, SG_EMPTY, SG_MAXPOINT, and SG_WHITE.

Referenced by Init(), and Play().

void GoUctBoard::CheckConsistencyBlock ( SgPoint  p  )  const [private]
void GoUctBoard::CreateSingleStoneBlock ( SgPoint  p,
SgBlackWhite  c 
) [private]
int GoUctBoard::FirstBoardPoint (  )  const

See SgBoardConst::FirstBoardPoint.

Definition at line 584 of file GoUctBoard.h.

References SgBoardConst::FirstBoardPoint(), and m_const.

bool GoUctBoard::FullBoardRepetition (  )  const [private]
SgPoint GoUctBoard::Get2ndLastMove (  )  const

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

Conditions similar to GetLastMove().

Definition at line 594 of file GoUctBoard.h.

References m_secondLastMove.

SgBoardColor GoUctBoard::GetColor ( SgPoint  p  )  const

Definition at line 599 of file GoUctBoard.h.

References m_color.

Referenced by CheckConsistencyBlock(), IsSingleStone(), and IsSuicide().

SgPoint GoUctBoard::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 604 of file GoUctBoard.h.

References m_lastMove.

SgBlackWhite GoUctBoard::GetStone ( SgPoint  p  )  const

Definition at line 609 of file GoUctBoard.h.

References m_color, Occupied(), and SG_ASSERT.

Referenced by AdjacentBlocks().

bool GoUctBoard::HasDiagonals ( SgPoint  p,
SgBoardColor  c 
) const

Definition at line 615 of file GoUctBoard.h.

References IsColor(), SG_NS, and SG_WE.

Referenced by HasNeighborsOrDiags().

bool GoUctBoard::HasEmptyNeighbors ( SgPoint  p  )  const

Definition at line 623 of file GoUctBoard.h.

References m_nuNeighborsEmpty.

Referenced by IsSuicide().

bool GoUctBoard::HasLiberties ( SgPoint  p  )  const [private]

Definition at line 628 of file GoUctBoard.h.

References NumLiberties().

Referenced by Play().

bool GoUctBoard::HasNeighbors ( SgPoint  p,
SgBlackWhite  c 
) const

Definition at line 633 of file GoUctBoard.h.

References m_nuNeighbors.

Referenced by HasNeighborsOrDiags().

bool GoUctBoard::HasNeighborsOrDiags ( SgPoint  p,
SgBlackWhite  c 
) const

Definition at line 638 of file GoUctBoard.h.

References HasDiagonals(), and HasNeighbors().

bool GoUctBoard::InAtari ( SgPoint  p  )  const

Return whether the number of liberties of the block at 'p' is one.

Requires: Occupied(p)

Definition at line 643 of file GoUctBoard.h.

References AtMostNumLibs(), Occupied(), and SG_ASSERT.

bool GoUctBoard::InCenter ( SgPoint  p  )  const
bool GoUctBoard::InCorner ( SgPoint  p  )  const
void GoUctBoard::Init ( const GoBoard bd  ) 
void GoUctBoard::InitSize ( const GoBoard bd  )  [private]
bool GoUctBoard::IsAdjacentTo ( SgPoint  p,
const Block block 
) const [private]

Definition at line 168 of file GoUctBoard.cpp.

References m_block, SG_NS, and SG_WE.

Referenced by AddStoneToBlock().

bool GoUctBoard::IsBorder ( SgPoint  p  )  const

Definition at line 697 of file GoUctBoard.h.

References m_isBorder, SG_ASSERT, and SG_PASS.

Referenced by CheckConsistency(), CheckConsistencyBlock(), IsSuicide(), and IsValidPoint().

bool GoUctBoard::IsColor ( SgPoint  p,
int  c 
) const
bool GoUctBoard::IsEmpty ( SgPoint  p  )  const
bool GoUctBoard::IsInBlock ( SgPoint  p,
SgPoint  anchor 
) const

See GoBoard::IsInBlock.

Definition at line 649 of file GoUctBoard.h.

References GoUctBoard::Block::m_anchor, m_block, Occupied(), and SG_ASSERT.

bool GoUctBoard::IsLegal ( int  p  )  const

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

See also:
IsLegal(int, SgBlackWhite).

Definition at line 733 of file GoUctBoard.h.

References IsLegal(), and ToPlay().

bool GoUctBoard::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.

Definition at line 716 of file GoUctBoard.h.

References SgPointUtil::InBoardRange(), IsEmpty(), IsSuicide(), m_koPoint, m_toPlay, SG_ASSERT, SG_ASSERT_BW, and SG_PASS.

Referenced by IsLegal().

bool GoUctBoard::IsLibertyOfBlock ( SgPoint  p,
SgPoint  anchor 
) const
bool GoUctBoard::IsSingleStone ( SgPoint  p  )  const

Return NumStones(p) == 1.

Definition at line 738 of file GoUctBoard.h.

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

bool GoUctBoard::IsSuicide ( SgPoint  p  )  const

Definition at line 743 of file GoUctBoard.h.

References IsSuicide(), and ToPlay().

bool GoUctBoard::IsSuicide ( SgPoint  p,
SgBlackWhite  toPlay 
) const

Definition at line 679 of file GoUctBoard.h.

References GetColor(), HasEmptyNeighbors(), IsBorder(), NumLiberties(), and SgOppBW().

Referenced by IsLegal(), and IsSuicide().

bool GoUctBoard::IsValidPoint ( SgPoint  p  )  const

Definition at line 748 of file GoUctBoard.h.

References SgPointUtil::InBoardRange(), and IsBorder().

Referenced by NumLiberties(), and Play().

void GoUctBoard::KillBlock ( const Block block  )  [private]
int GoUctBoard::LastBoardPoint (  )  const

See SgBoardConst::FirstBoardPoint.

Definition at line 753 of file GoUctBoard.h.

References SgBoardConst::LastBoardPoint(), and m_const.

int GoUctBoard::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 758 of file GoUctBoard.h.

References SgBoardConst::Left(), and m_const.

SgGrid GoUctBoard::Line ( SgPoint  p  )  const

See SgBoardConst::Line.

Definition at line 763 of file GoUctBoard.h.

References SgBoardConst::Line(), and m_const.

void GoUctBoard::MergeBlocks ( SgPoint  p,
const SgArrayList< Block *, 4 > &  adjBlocks 
) [private]
void GoUctBoard::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 768 of file GoUctBoard.h.

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

void GoUctBoard::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 298 of file GoUctBoard.cpp.

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

int GoUctBoard::NuCapturedStones (  )  const

The stones captured by the most recent move.

See also:
CapturedStones

Definition at line 804 of file GoUctBoard.h.

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

Referenced by GoUctGlobalSearchState< POLICY >::ExecutePlayout().

int GoUctBoard::Num8EmptyNeighbors ( SgPoint  p  )  const

Includes diagonals.

Definition at line 799 of file GoUctBoard.h.

References NumEmptyDiagonals(), and NumEmptyNeighbors().

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

Includes diagonals.

Definition at line 794 of file GoUctBoard.h.

References NumDiagonals(), and NumNeighbors().

int GoUctBoard::NumDiagonals ( SgPoint  p,
SgBoardColor  c 
) const

Definition at line 809 of file GoUctBoard.h.

References IsColor(), SG_NS, and SG_WE.

Referenced by Num8Neighbors(), and NumEmptyDiagonals().

int GoUctBoard::NumEmptyDiagonals ( SgPoint  p  )  const

Definition at line 823 of file GoUctBoard.h.

References NumDiagonals(), and SG_EMPTY.

Referenced by Num8EmptyNeighbors().

int GoUctBoard::NumEmptyNeighbors ( SgPoint  p  )  const

Definition at line 828 of file GoUctBoard.h.

References m_nuNeighborsEmpty.

Referenced by CheckConsistency(), and Num8EmptyNeighbors().

int GoUctBoard::NumLiberties ( SgPoint  p  )  const

Return the number of liberties of the block at 'p'.

Not defined for empty or border points.

Definition at line 833 of file GoUctBoard.h.

References IsValidPoint(), m_block, Occupied(), and SG_ASSERT.

Referenced by AtLeastNumLibs(), AtMostNumLibs(), HasLiberties(), IsSuicide(), Play(), and TheLiberty().

int GoUctBoard::NumNeighbors ( SgPoint  p,
SgBlackWhite  c 
) const
int GoUctBoard::NumPrisoners ( SgBlackWhite  color  )  const

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

Definition at line 845 of file GoUctBoard.h.

References m_prisoners.

int GoUctBoard::NumStones ( SgPoint  p  )  const

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

Not defined for empty or border points.

Definition at line 850 of file GoUctBoard.h.

References m_block, Occupied(), and SG_ASSERT.

Referenced by CheckConsistencyBlock(), and Play().

bool GoUctBoard::Occupied ( SgPoint  p  )  const
bool GoUctBoard::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 861 of file GoUctBoard.h.

References m_block, and GoUctBoard::Block::m_liberties.

bool GoUctBoard::OnEdge ( SgPoint  p  )  const
GoUctBoard& GoUctBoard::operator= ( const GoUctBoard  )  [private]

Not implemented.

SgBlackWhite GoUctBoard::Opponent (  )  const

Opponent of player whose turn it is to play.

Definition at line 867 of file GoUctBoard.h.

References m_toPlay, and SgOppBW().

void GoUctBoard::Play ( SgPoint  p  ) 
SgGrid GoUctBoard::Pos ( SgPoint  p  )  const

See SgBoardConst::Pos.

Definition at line 872 of file GoUctBoard.h.

References m_const, and SgBoardConst::Pos().

void GoUctBoard::RemoveLibAndKill ( SgPoint  p,
SgBlackWhite  opp,
SgArrayList< Block *, 4 > &  ownAdjBlocks 
) [private]

Remove liberty from adjacent blocks and kill opponent blocks without liberties.

As a side effect, computes adjacent blocks of own color to avoid a second call to GetAdjacentBlocks() in UpdateBlocksAfterAddStone().

Definition at line 340 of file GoUctBoard.cpp.

References SgMarker::Clear(), SgMarker::Contains(), SgMarker::Include(), KillBlock(), GoUctBoard::Block::m_anchor, m_block, GoUctBoard::Block::m_color, GoUctBoard::Block::m_liberties, m_marker, SgMarker::NewMark(), SgArrayList< T, SIZE >::PushBack(), SG_NS, and SG_WE.

Referenced by Play().

int GoUctBoard::Right ( SgPoint  p  )  const

Returns the offset along right side of the board.

See also:
Left for more info.

Definition at line 877 of file GoUctBoard.h.

References m_const, and SgBoardConst::Right().

int GoUctBoard::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 882 of file GoUctBoard.h.

References m_const, and SgBoardConst::Side().

SgGrid GoUctBoard::Size (  )  const

Return the size of this board.

Definition at line 887 of file GoUctBoard.h.

References m_size.

SgPoint GoUctBoard::TheLiberty ( SgPoint  blockInAtari  )  const

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

Definition at line 892 of file GoUctBoard.h.

References m_block, NumLiberties(), Occupied(), and SG_ASSERT.

SgBlackWhite GoUctBoard::ToPlay (  )  const
int GoUctBoard::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 904 of file GoUctBoard.h.

References m_const, and SgBoardConst::Up().

void GoUctBoard::UpdateBlocksAfterAddStone ( SgPoint  p,
SgBlackWhite  c,
const SgArrayList< Block *, 4 > &  adjBlocks 
) [private]

Friends And Related Function Documentation

friend class LibertyIterator [friend]

Definition at line 386 of file GoUctBoard.h.

friend class StoneIterator [friend]

Definition at line 387 of file GoUctBoard.h.


Member Data Documentation

SgArray<Block*,SG_MAXPOINT> GoUctBoard::m_block [private]

Definition at line 341 of file GoUctBoard.h.

Referenced by CreateSingleStoneBlock(), and Init().

Definition at line 347 of file GoUctBoard.h.

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

SgArray<int,SG_MAXPOINT> GoUctBoard::m_color [private]

The current board position.

Definition at line 327 of file GoUctBoard.h.

Referenced by AddLibToAdjBlocks(), AddStone(), CheckConsistency(), GetColor(), GetStone(), Init(), InitSize(), IsColor(), IsEmpty(), KillBlock(), and MergeBlocks().

Data that's constant for this board size.

Definition at line 336 of file GoUctBoard.h.

Referenced by BoardConst(), FirstBoardPoint(), InitSize(), LastBoardPoint(), Left(), Line(), Pos(), Right(), Side(), and Up().

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

Definition at line 349 of file GoUctBoard.h.

Referenced by InitSize(), and IsBorder().

Point which is currently illegal for simple Ko rule.

Definition at line 316 of file GoUctBoard.h.

Referenced by Init(), IsLegal(), KillBlock(), and Play().

Definition at line 311 of file GoUctBoard.h.

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

SgMarker GoUctBoard::m_marker [mutable, private]

Definition at line 343 of file GoUctBoard.h.

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

Definition at line 345 of file GoUctBoard.h.

Referenced by AddLibToAdjBlocks().

SgBWArray<SgArray<int,SG_MAXPOINT> > GoUctBoard::m_nuNeighbors [private]

Number of black and white neighbors.

Definition at line 333 of file GoUctBoard.h.

Referenced by AddStone(), HasNeighbors(), Init(), InitSize(), IsLibertyOfBlock(), KillBlock(), and NumNeighbors().

SgArray<int,SG_MAXPOINT> GoUctBoard::m_nuNeighborsEmpty [private]

Number of black and white neighbors.

Definition at line 330 of file GoUctBoard.h.

Referenced by AddStone(), HasEmptyNeighbors(), Init(), InitSize(), KillBlock(), and NumEmptyNeighbors().

Number of prisoners of each color.

Definition at line 324 of file GoUctBoard.h.

Referenced by Init(), KillBlock(), and NumPrisoners().

Definition at line 313 of file GoUctBoard.h.

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

The current board size.

Definition at line 339 of file GoUctBoard.h.

Referenced by GoUctBoard(), Init(), InitSize(), and Size().

Whose turn it is to play.

Definition at line 319 of file GoUctBoard.h.

Referenced by Init(), IsLegal(), Opponent(), Play(), and ToPlay().

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 51 of file GoUctBoard.h.


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


Sun Mar 13 2011 Doxygen 1.7.1