Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GoSafetyUtil Namespace Reference


Functions

void AddToSafe (const GoBoard &board, const SgPointSet &pts, SgBlackWhite color, SgBWSet *safe, const char *reason, int depth, bool addBoundary)
 Add pts to *safe[color].
bool ExtendedMightMakeLife (const GoBoard &board, GoRegionBoard *regions, const SgPointSet &area, const SgPointSet &safe, SgBlackWhite color)
 Extended version of MightMakeLife.
SgPointSet FindDamePoints (const GoBoard &board, const SgPointSet &empty, const SgBWSet &safe)
 See FindDameAndUnsurroundablePoints.
void FindDameAndUnsurroundablePoints (const GoBoard &bd, const SgPointSet &empty, const SgBWSet &safe, SgPointSet *dame, SgPointSet *unsurroundable)
 Find dame and unsurroundable points.
bool MightMakeLife (const GoBoard &board, const SgPointSet &area, const SgPointSet &safe, SgBlackWhite color)
 Test whether color can make 2 eyes inside a surrounded area.
bool Find2Libs (SgPoint p, SgPointSet *libs)
 Helper function for 1-vitality test.
bool Find2BestLibs (SgPoint p, const SgPointSet &libs, SgPointSet interior, SgMiaiPair *miaiPair)
 Helper function for 1-vitality test.
bool ExtendedIsTerritory (const GoBoard &board, GoRegionBoard *regions, const SgPointSet &pts, const SgPointSet &safe, SgBlackWhite color)
 Stronger version of IsTerritory that uses region information This version checks for opponent nakade inside the area.
bool IsTerritory (const GoBoard &board, const SgPointSet &pts, const SgPointSet &safe, SgBlackWhite color)
 Simple static territory check for surrounded area.
void ReduceToAnchors (const GoBoard &board, const SgPointSet &stones, SgVector< SgPoint > *anchors)
 Given set of stones, reduce to block anchors.
void WriteStatistics (const std::string &heading, const GoRegionBoard *regions, const SgBWSet *safe)
 Write statistics about the safe points.


Function Documentation

void GoSafetyUtil::AddToSafe ( const GoBoard board,
const SgPointSet pts,
SgBlackWhite  color,
SgBWSet safe,
const char *  reason,
int  depth,
bool  addBoundary 
)

Add pts to *safe[color].

Definition at line 173 of file GoSafetyUtil.cpp.

References GoBoard::AllEmpty(), SgBWSet::AssertDisjoint(), SgPointSet::Border(), DEBUG_SAFETY, GoBoardUtil::ExpandToBlocks(), SG_ASSERT, SG_UNUSED(), SgDebug(), and GoBoard::Size().

Referenced by GoSafetySolver::FindSafePair(), GoSafetySolver::FindSurroundedSingleRegion(), GoSafetySolver::Test2Vital(), and GoStaticSafetySolver::TestAlive().

bool GoSafetyUtil::ExtendedMightMakeLife ( const GoBoard board,
GoRegionBoard regions,
const SgPointSet area,
const SgPointSet safe,
SgBlackWhite  color 
)

Extended version of MightMakeLife.

Recognizes some nakade shapes as dead. Useful mostly for semeai solver.

Definition at line 200 of file GoSafetyUtil.cpp.

References GoBoard::All(), GoRegionBoard::AllRegions(), SgPointSet::Border(), GoEyeUtil::CanBecomeSinglePointEye(), DEBUG_EXTENDED_MIGHT_MAKE_LIFE, GO_REGION_COMPUTED_NAKADE, MightMakeLife(), SgBW(), SgDebug(), GoBoard::Size(), and SgPointSet::SupersetOf().

Referenced by ExtendedIsTerritory().

SgPointSet GoSafetyUtil::FindDamePoints ( const GoBoard bd,
const SgPointSet empty,
const SgBWSet safe 
)

See FindDameAndUnsurroundablePoints.

Definition at line 274 of file GoSafetyUtil.cpp.

References FindDameAndUnsurroundablePoints().

Referenced by GoSafetyCommands::CmdDameStatic().

void GoSafetyUtil::FindDameAndUnsurroundablePoints ( const GoBoard bd,
const SgPointSet empty,
const SgBWSet safe,
SgPointSet dame,
SgPointSet unsurroundable 
)

Find dame and unsurroundable points.

Given sets of empty points and safe points, compute subset of dame points. Given safe B+W stones, find empty which are surely dame, using the algorithm of [Mueller1995]. Unsurroundable points are empty points that can not be surrounded by either player because they are adjacent to both player's safe stones. However, they can potentially have an effect on unsafe stones or on other empty points. Dame points are a subset of unsurroundable points that have no effect on other points - no matter if they will be occupied by Black, White, or remain empty.

Definition at line 283 of file GoSafetyUtil.cpp.

References GoBoard::All(), SgPointSet::Contains(), SgPointSet::Include(), SgPointSet::IsEmpty(), SG_ASSERT, SG_BLACK, SG_WHITE, and GoBoard::Size().

Referenced by GoSafetyCommands::CmdGfx(), and FindDamePoints().

bool GoSafetyUtil::MightMakeLife ( const GoBoard board,
const SgPointSet area,
const SgPointSet safe,
SgBlackWhite  color 
)

Test whether color can make 2 eyes inside a surrounded area.

Precondition: area surrounded by safe stones of opponent. Basic test, handles 1 and 2 point eyes only.

Definition at line 320 of file GoSafetyUtil.cpp.

References GoBoard::All(), SgPointUtil::AreAdjacent(), SgPointSet::Border(), GoEyeUtil::CanBecomeSinglePointEye(), DEBUG_MIGHT_MAKE_LIFE, SgPointSet::MaxSetSize(), SG_NULLPOINT, SgDebug(), and GoBoard::Size().

Referenced by GoRegion::DoComputeFlag(), ExtendedMightMakeLife(), Find2ConnectionsForAll(), and IsTerritory().

bool GoSafetyUtil::Find2Libs ( SgPoint  p,
SgPointSet libs 
)

Helper function for 1-vitality test.

Try to find two matching liberties for point p, subtract them from libs if found.

Definition at line 360 of file GoSafetyUtil.cpp.

References SgVector< T >::Back(), SgPointSet::Exclude(), SgVector< T >::Front(), SgVector< T >::IsLength(), SG_ASSERT, SG_NS, SG_WE, and TestLiberty().

Referenced by Find2ConnectionsForAll(), and GoRegion::Find2ConnForAll().

bool GoSafetyUtil::Find2BestLibs ( SgPoint  p,
const SgPointSet libs,
SgPointSet  interior,
SgMiaiPair miaiPair 
)

Helper function for 1-vitality test.

Similar to Find2Libs(), but try to find miaiPair of two best liberties (not shared with other interior points).

Definition at line 382 of file GoSafetyUtil.cpp.

References SgPointUtil::AreAdjacent(), SgPointSet::Exclude(), SgVector< T >::IsLength(), SgVector< T >::MaxLength(), SgVector< T >::MinLength(), SgVector< T >::PushBack(), SG_ASSERT, SG_NS, SG_WE, and TestLiberty().

Referenced by GoRegion::Find2ConnForAllInterior().

bool GoSafetyUtil::ExtendedIsTerritory ( const GoBoard board,
GoRegionBoard regions,
const SgPointSet pts,
const SgPointSet safe,
SgBlackWhite  color 
)

Stronger version of IsTerritory that uses region information This version checks for opponent nakade inside the area.

Useful for proving safe semeai test cases after resolving semeai.

Definition at line 448 of file GoSafetyUtil.cpp.

References SgPointSet::Border(), ExtendedMightMakeLife(), IsTerritory(), SgPointSet::Overlaps(), SG_ASSERT, SgOppBW(), and GoBoard::Size().

Referenced by GoSafetySolver::FindSurroundedSingleRegion().

bool GoSafetyUtil::IsTerritory ( const GoBoard board,
const SgPointSet pts,
const SgPointSet safe,
SgBlackWhite  color 
)

Simple static territory check for surrounded area.

Definition at line 467 of file GoSafetyUtil.cpp.

References GoBoard::All(), SgPointSet::Border(), Find2ConnectionsForAll(), MightMakeLife(), SgPointSet::Overlaps(), SG_ASSERT, SgOppBW(), and GoBoard::Size().

Referenced by ExtendedIsTerritory(), and GoSafetySolver::FindSafePair().

void GoSafetyUtil::ReduceToAnchors ( const GoBoard board,
const SgPointSet stones,
SgVector< SgPoint > *  anchors 
)

Given set of stones, reduce to block anchors.

Definition at line 487 of file GoSafetyUtil.cpp.

References GoBoard::Anchor(), SgVector< T >::Insert(), SgVector< T >::IsEmpty(), GoBoard::Occupied(), and SG_ASSERT.

Referenced by Find2ConnectionsForAll().

void GoSafetyUtil::WriteStatistics ( const std::string &  heading,
const GoRegionBoard regions,
const SgBWSet safe 
)

Write statistics about the safe points.

Definition at line 499 of file GoSafetyUtil.cpp.

References GoRegionBoard::AllBlocks(), GoRegionBoard::AllRegions(), GoRegionBoard::Board(), SgBWSet::Both(), SgPointSet::Overlaps(), SgDebug(), SgPointSet::Size(), GoBoard::Size(), and WriteSafeTotal().

Referenced by GoSafetySolver::FindSafePoints(), and GoBensonSolver::FindSafePoints().


17 Jun 2010 Doxygen 1.4.7