Set of GoBlock's that are a connected unit. More...
#include <GoChain.h>

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 SgPointSet & | FreeLiberties () 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 SgPointSet & | Stones () 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< GoRegion > | m_healthy |
| list of healthy regions | |
| bool | m_has1Eye |
| does block have one eye? | |
| const GoBoard & | m_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< GoChainCondition > | m_chainConditions |
| All conditions used to create chain. | |
Static Private Attributes | |
| static int | s_alloc = 0 |
| Used for debugging only. | |
| static int | s_free = 0 |
Set of GoBlock's that are a connected unit.
Definition at line 96 of file GoChain.h.
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 | |||
| ) |
Constructor by merging two chains.
Definition at line 17 of file GoChain.cpp.
References SgPointSet::Contains(), SgPointSet::Exclude(), GoBlock::Healthy(), GoChainCondition::Lib1(), GoChainCondition::Lib2(), m_chainConditions, m_freeLiberties, GoBlock::m_healthy, GoChainCondition::Overlaps(), SgVectorOf< T >::PushBack(), s_alloc, SG_ASSERT, SgVectorOf< T >::Union(), and GoChainCondition::UsesLibs().
| virtual GoChain::~GoChain | ( | ) | [virtual] |
| 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] |
The unique stone with smallest number identifying a block.
Definition at line 63 of file GoBlock.h.
References GoBlock::m_anchor.
Referenced by GoRegionBoard::AddBlock(), GoBlock::AllEmptyAreLiberties(), GoBlock::CheckConsistency(), GoRegion::HasBlockLibs(), GoRegion::HasLibsForBlock(), GoRegion::InsideLibs(), GoRegion::IsInteriorBlock(), GoRegion::JointLibs(), WriteID(), and GoBlock::WriteID().
| 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] |
For debugging.
Definition at line 66 of file GoBlock.cpp.
References GoBoard::All(), GoBoard::Anchor(), GoBlock::Anchor(), GoBlock::Color(), GoBlock::m_bd, SG_ASSERT, and GoBlock::Stones().
| SgBlackWhite GoBlock::Color | ( | ) | const [inherited] |
Definition at line 57 of file GoBlock.h.
References GoBlock::m_color.
Referenced by GoRegionBoard::AddBlock(), GoBlock::CheckConsistency(), GetBlocks(), GoRegion::IsInteriorBlock(), GoSafetySolver::Merge(), GoRegionBoard::RemoveBlock(), GoRegion::ReplaceChain(), GoStaticSafetySolver::TestAlive(), TestFor1Eye(), WriteID(), and GoBlock::WriteID().
| 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] |
| 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
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] |
For undo: remove added stone.
Definition at line 37 of file GoBlock.cpp.
References GoBoard::Anchor(), SgPointSet::Contains(), SgPointSet::Exclude(), HEAVYCHECK, GoBlock::m_anchor, GoBlock::m_bd, GoBlock::m_stones, SgPointSet::PointOf(), and SG_ASSERT.
Referenced by GoRegionBoard::OnUndoneMove().
| 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] |
set of all stones
Definition at line 69 of file GoBlock.h.
References GoBlock::m_stones.
Referenced by GoBlock::CheckConsistency(), GoRegion::Find2ConnForAll(), GetBlocks(), GoRegion::ProtectedCuts(), GoRegionBoard::RemoveBlock(), GoRegion::Safe2Cuts(), GoRegionBoard::UpdateBlock(), and GoBlock::Write().
| 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().
const GoBoard& GoBlock::m_bd [protected, inherited] |
board
Definition at line 175 of file GoBlock.h.
Referenced by GoBlock::AddStone(), AllEmptyAreLiberties(), GoBlock::AllEmptyAreLiberties(), GoBlock::CheckConsistency(), GoBlock::HasLiberty(), GoBlock::Liberties(), GoBlock::NuLiberties(), and GoBlock::RemoveStone().
SgVectorOf<GoChainCondition> GoChain::m_chainConditions [private] |
All conditions used to create chain.
Definition at line 167 of file GoChain.h.
Referenced by ChainConditions(), FreeChainConditions(), and GoChain().
SgPointSet GoChain::m_freeLiberties [private] |
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] |
list of healthy regions
Definition at line 169 of file GoBlock.h.
Referenced by GoBlock::AddHealthy(), GoBlock::ContainsHealthy(), GoChain(), GoBlock::Healthy(), GoBlock::ReInitialize(), and GoBlock::RemoveRegion().
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] |
int GoChain::s_free = 0 [static, private] |
Reimplemented from GoBlock.
Definition at line 170 of file GoChain.h.
Referenced by Fini(), and ~GoChain().