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

GoChain Class Reference

Set of GoBlock's that are a connected unit. More...

#include <GoChain.h>

Inheritance diagram for GoChain:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GoChain (const GoBlock *b, const GoBoard &board)
 Constructor from single block.
 GoChain (const GoChain *c1, const GoChain *c2, GoChainCondition *cond)
 Constructor by merging two chains.
virtual ~GoChain ()
 Destructor.
void CheckConsistency (const GoBoard &bd) const
 For debugging.
void Write (std::ostream &out) const
 Write data of chain.
void WriteID (std::ostream &out) const
 Write short identifier.
virtual bool AllEmptyAreLiberties (const SgPointSet &area) const
 are all empty points in area liberties of this?
bool IsSingleBlock () const
 Does the chain consist of a single block, or more than one?
void TestFor1Eye (const GoRegionBoard *ra)
 does chain have one eye? Uses blocks' eyes and 1vc regions
const SgPointSetFreeLiberties () const
 Free liberties are liberties not used to define chains.
const SgVectorOf
< GoChainCondition > & 
ChainConditions () const
 See m_chainConditions.
void GetBlocks (const GoRegionBoard *ra, SgVectorOf< GoBlock > *blocks) const
 returns list of all blocks in chain
void CheckConsistency () const
 For debugging.
SgBlackWhite Color () const
SgPoint Anchor () const
 The unique stone with smallest number identifying a block.
const SgPointSetStones () const
 set of all stones
int NuLiberties () const
 number of liberties
SgPointSet Liberties () const
 set of all liberties
bool IsSafe () const
 is block proven safe?
bool HasLiberty (SgPoint lib) const
 is lib our liberty?
bool Has1Eye () const
 Does block have a simple eye?
void SetToSafe ()
 Mark block as proven safe.
void TestFor1Eye (const GoRegion *r)
 compute if block has 1 clear eye, if yes set the m_has1Eye flag
virtual void ReInitialize ()
 Clear previous computation.
void AddStone (SgPoint stone)
 For incremental computation: add stone to block.
void RemoveStone (SgPoint stone)
 For undo: remove added stone.
void AddHealthy (GoRegion *r)
 r is healthy for this
void RemoveRegion (GoRegion *r)
 For incremental computation: r is no longer a neighbor region.
bool ContainsHealthy (const GoRegion *r) const
 is r in our healthy list?
const SgVectorOf< GoRegion > & Healthy () const
 list of healthy regions

Static Public Member Functions

static void Fini ()
 class Finalization

Protected Attributes

SgVectorOf< GoRegionm_healthy
 list of healthy regions
bool m_has1Eye
 does block have one eye?
const GoBoardm_bd
 board

Private Member Functions

void FreeChainConditions ()

Private Attributes

bool m_isSingleBlock
 Does the chain consist of a single block, or more than one?
SgPointSet m_freeLiberties
 Free liberties are liberties not used to define chains.
SgVectorOf< GoChainConditionm_chainConditions
 All conditions used to create chain.

Static Private Attributes

static int s_alloc = 0
 Used for debugging only.
static int s_free = 0

Detailed Description

Set of GoBlock's that are a connected unit.

Definition at line 96 of file GoChain.h.


Constructor & Destructor Documentation

GoChain::GoChain ( const GoBlock b,
const GoBoard board 
)

Constructor from single block.

Definition at line 101 of file GoChain.h.

References GoBlock::IsSafe(), s_alloc, and GoBlock::SetToSafe().

GoChain::GoChain ( const GoChain c1,
const GoChain c2,
GoChainCondition cond 
)
virtual GoChain::~GoChain (  )  [virtual]

Destructor.

Definition at line 114 of file GoChain.h.

References FreeChainConditions(), and s_free.


Member Function Documentation

void GoBlock::AddHealthy ( GoRegion r  )  [inherited]

r is healthy for this

Definition at line 132 of file GoBlock.h.

References SgVectorOf< T >::Contains(), GoBlock::m_healthy, SgVectorOf< T >::PushBack(), and SgDebug().

void GoBlock::AddStone ( SgPoint  stone  )  [inherited]

For incremental computation: add stone to block.

Definition at line 24 of file GoBlock.cpp.

References GoBoard::Anchor(), SgPointSet::Contains(), HEAVYCHECK, SgPointSet::Include(), GoBlock::m_anchor, GoBlock::m_bd, GoBlock::m_stones, and SG_ASSERT.

Referenced by GoRegionBoard::AppendStone().

bool GoChain::AllEmptyAreLiberties ( const SgPointSet area  )  const [virtual]

are all empty points in area liberties of this?

Reimplemented from GoBlock.

Definition at line 77 of file GoChain.cpp.

References GoBoard::AllEmpty(), GoBlock::Liberties(), and GoBlock::m_bd.

SgPoint GoBlock::Anchor (  )  const [inherited]
const SgVectorOf<GoChainCondition>& GoChain::ChainConditions (  )  const

See m_chainConditions.

Definition at line 145 of file GoChain.h.

References m_chainConditions.

Referenced by Write().

void GoChain::CheckConsistency ( const GoBoard bd  )  const

For debugging.

void GoBlock::CheckConsistency (  )  const [inherited]
SgBlackWhite GoBlock::Color (  )  const [inherited]
bool GoBlock::ContainsHealthy ( const GoRegion r  )  const [inherited]

is r in our healthy list?

Definition at line 153 of file GoBlock.h.

References SgVectorOf< T >::Contains(), and GoBlock::m_healthy.

void GoChain::Fini (  )  [static]

class Finalization

Reimplemented from GoBlock.

Definition at line 88 of file GoChain.cpp.

References s_alloc, s_free, and SG_ASSERT.

void GoChain::FreeChainConditions (  )  [private]

Definition at line 60 of file GoChain.cpp.

References SgVectorOf< T >::Clear(), and m_chainConditions.

Referenced by ~GoChain().

const SgPointSet& GoChain::FreeLiberties (  )  const

Free liberties are liberties not used to define chains.

Definition at line 142 of file GoChain.h.

References m_freeLiberties.

Referenced by GoRegion::Find2FreeLibs(), and GoRegion::Has2ConnForChains().

void GoChain::GetBlocks ( const GoRegionBoard ra,
SgVectorOf< GoBlock > *  blocks 
) const

returns list of all blocks in chain

Definition at line 67 of file GoChain.cpp.

References GoRegionBoard::AllBlocks(), GoBlock::Color(), SgPointSet::Contains(), SgVectorOf< T >::PushBack(), and GoBlock::Stones().

Referenced by TestFor1Eye().

bool GoBlock::Has1Eye (  )  const [inherited]

Does block have a simple eye?

Definition at line 103 of file GoBlock.h.

References GoBlock::m_has1Eye.

Referenced by GoBlock::Write().

bool GoBlock::HasLiberty ( SgPoint  lib  )  const [inherited]

is lib our liberty?

Definition at line 97 of file GoBlock.h.

References GoBoard::IsLibertyOfBlock(), GoBlock::m_anchor, and GoBlock::m_bd.

const SgVectorOf<GoRegion>& GoBlock::Healthy (  )  const [inherited]

list of healthy regions

Definition at line 159 of file GoBlock.h.

References GoBlock::m_healthy.

Referenced by GoStaticSafetySolver::FindClosure(), GoSafetySolver::FindClosure(), GoChain(), and GoBlock::Write().

bool GoBlock::IsSafe (  )  const [inherited]

is block proven safe?

Definition at line 88 of file GoBlock.h.

References GoBlock::m_isSafe.

Referenced by GoChain(), GoRegionBoard::IsSafeBlock(), and GoBlock::Write().

bool GoChain::IsSingleBlock (  )  const

Does the chain consist of a single block, or more than one?

Definition at line 133 of file GoChain.h.

References m_isSingleBlock.

SgPointSet GoBlock::Liberties (  )  const [inherited]

set of all liberties

Todo:
slow

Definition at line 82 of file GoBlock.h.

References GoBoard::AllEmpty(), SgPointSet::Border(), GoBlock::m_bd, GoBlock::m_stones, and GoBoard::Size().

Referenced by AllEmptyAreLiberties().

int GoBlock::NuLiberties (  )  const [inherited]

number of liberties

Definition at line 75 of file GoBlock.h.

References GoBlock::m_anchor, GoBlock::m_bd, and GoBoard::NumLiberties().

virtual void GoBlock::ReInitialize (  )  [virtual, inherited]

Clear previous computation.

Definition at line 118 of file GoBlock.h.

References SgVectorOf< T >::Clear(), GoBlock::m_has1Eye, GoBlock::m_healthy, and GoBlock::m_isSafe.

void GoBlock::RemoveRegion ( GoRegion r  )  [inherited]

For incremental computation: r is no longer a neighbor region.

Definition at line 146 of file GoBlock.h.

References SgVectorOf< T >::Exclude(), and GoBlock::m_healthy.

void GoBlock::RemoveStone ( SgPoint  stone  )  [inherited]
void GoBlock::SetToSafe (  )  [inherited]

Mark block as proven safe.

Definition at line 109 of file GoBlock.h.

References GoBlock::m_isSafe.

Referenced by GoChain(), and GoRegionBoard::SetToSafe().

const SgPointSet& GoBlock::Stones (  )  const [inherited]
void GoChain::TestFor1Eye ( const GoRegionBoard ra  ) 

does chain have one eye? Uses blocks' eyes and 1vc regions

Definition at line 39 of file GoChain.cpp.

References GoRegionBoard::AllRegions(), GoBlock::Color(), GetBlocks(), GO_REGION_1VC, and GoBlock::m_has1Eye.

void GoBlock::TestFor1Eye ( const GoRegion r  )  [inherited]

compute if block has 1 clear eye, if yes set the m_has1Eye flag

Definition at line 57 of file GoBlock.cpp.

References GoRegion::Blocks(), GoRegion::GetFlag(), GO_REGION_SMALL, SgVectorOf< T >::IsLength(), and GoBlock::m_has1Eye.

void GoChain::Write ( std::ostream &  out  )  const [virtual]

Write data of chain.

Reimplemented from GoBlock.

Definition at line 93 of file GoChain.cpp.

References ChainConditions().

Referenced by operator<<().

void GoChain::WriteID ( std::ostream &  out  )  const [virtual]

Write short identifier.

Reimplemented from GoBlock.

Definition at line 82 of file GoChain.cpp.

References GoBlock::Anchor(), GoBlock::Color(), and SgBW().

Referenced by GoSafetySolver::Merge().


Member Data Documentation

const GoBoard& GoBlock::m_bd [protected, inherited]

All conditions used to create chain.

Definition at line 167 of file GoChain.h.

Referenced by ChainConditions(), FreeChainConditions(), and GoChain().

Free liberties are liberties not used to define chains.

Definition at line 164 of file GoChain.h.

Referenced by FreeLiberties(), and GoChain().

bool GoBlock::m_has1Eye [protected, inherited]

does block have one eye?

Definition at line 172 of file GoBlock.h.

Referenced by GoBlock::Has1Eye(), GoBlock::ReInitialize(), TestFor1Eye(), and GoBlock::TestFor1Eye().

SgVectorOf<GoRegion> GoBlock::m_healthy [protected, inherited]
bool GoChain::m_isSingleBlock [private]

Does the chain consist of a single block, or more than one?

Definition at line 161 of file GoChain.h.

Referenced by IsSingleBlock().

int GoChain::s_alloc = 0 [static, private]

Used for debugging only.

Reimplemented from GoBlock.

Definition at line 170 of file GoChain.h.

Referenced by Fini(), and GoChain().

int GoChain::s_free = 0 [static, private]

Reimplemented from GoBlock.

Definition at line 170 of file GoChain.h.

Referenced by Fini(), and ~GoChain().


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


Sun Mar 13 2011 Doxygen 1.7.1