Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Functions

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 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.
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.
SgEmptyBlackWhite GetWinner (const GoBoard &bd)
 Check if one player has already won.
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.
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 ExtendedMightMakeLife (const GoBoard &board, GoRegionBoard *regions, const SgPointSet &area, const SgPointSet &safe, SgBlackWhite color)
 Extended version of MightMakeLife.
bool MightMakeLife (const GoBoard &board, const SgPointSet &area, const SgPointSet &safe, SgBlackWhite color)
 Test whether color can make 2 eyes inside a surrounded area.
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 
)
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 518 of file GoSafetyUtil.cpp.

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

Referenced by GoSafetySolver::FindSurroundedSingleRegion().

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 270 of file GoSafetyUtil.cpp.

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

Referenced by ExtendedIsTerritory().

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 452 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, and SG_WE.

Referenced by GoRegion::Find2ConnForAllInterior().

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 430 of file GoSafetyUtil.cpp.

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

Referenced by GoRegion::Find2ConnForAll().

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

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

See FindDameAndUnsurroundablePoints.

Definition at line 344 of file GoSafetyUtil.cpp.

References FindDameAndUnsurroundablePoints().

Referenced by GoSafetyCommands::CmdDameStatic().

SgEmptyBlackWhite GoSafetyUtil::GetWinner ( const GoBoard bd  ) 

Check if one player has already won.

Definition at line 537 of file GoSafetyUtil.cpp.

References GoModBoard::Board(), GoSafetySolver::FindSafePoints(), GoRules::Komi(), GoBoard::Rules(), and GoKomi::ToFloat().

Referenced by GoSafetyCommands::CmdWinner().

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

Simple static territory check for surrounded area.

Definition at line 550 of file GoSafetyUtil.cpp.

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

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

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 390 of file GoSafetyUtil.cpp.

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

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

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

Given set of stones, reduce to block anchors.

Definition at line 570 of file GoSafetyUtil.cpp.

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

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


Sun Mar 13 2011 Doxygen 1.7.1