Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GoSafetyUtil.cpp File Reference


Detailed Description

See GoSafetyUtil.h.

Definition in file GoSafetyUtil.cpp.

#include "SgSystem.h"
#include "GoSafetyUtil.h"
#include "GoBlock.h"
#include "GoBoard.h"
#include "GoBoardUtil.h"
#include "GoEyeUtil.h"
#include "GoRegion.h"
#include "GoRegionBoard.h"
#include "SgBWSet.h"
#include "SgVector.h"
#include "SgPointSet.h"
#include "SgPointSetUtil.h"
#include "SgWrite.h"

Go to the source code of this file.

Functions

bool Find2Connections (const GoBoard &bd, SgPoint block, SgPointSet *libs, SgPointSet *usedLibs, SgPointSet *safe)
 find 2 libs which would connect block to safe.
bool Find2ConnectionsForAll (const GoBoard &bd, const SgPointSet &pts, const SgPointSet &inSafe, SgBlackWhite color, int maxNuOmissions=0)
 Find connections for unsafe boundary and interior stones, and interior empty points.
void TestLiberty (SgPoint lib, const SgPointSet &libs, SgVector< SgPoint > *foundLibs, int *nuLibs)
void WriteSafeTotal (std::ostream &stream, std::string text, int partCount, int totalCount)
 write part and total and rounded percentage of part in total
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].
bool GoSafetyUtil::ExtendedMightMakeLife (const GoBoard &board, GoRegionBoard *regions, const SgPointSet &area, const SgPointSet &safe, SgBlackWhite color)
 Extended version of MightMakeLife.
SgPointSet GoSafetyUtil::FindDamePoints (const GoBoard &board, const SgPointSet &empty, const SgBWSet &safe)
 See FindDameAndUnsurroundablePoints.
void GoSafetyUtil::FindDameAndUnsurroundablePoints (const GoBoard &bd, const SgPointSet &empty, const SgBWSet &safe, SgPointSet *dame, SgPointSet *unsurroundable)
 Find dame and unsurroundable points.
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.
bool GoSafetyUtil::Find2Libs (SgPoint p, SgPointSet *libs)
 Helper function for 1-vitality test.
bool GoSafetyUtil::Find2BestLibs (SgPoint p, const SgPointSet &libs, SgPointSet interior, SgMiaiPair *miaiPair)
 Helper function for 1-vitality test.
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.
bool GoSafetyUtil::IsTerritory (const GoBoard &board, const SgPointSet &pts, const SgPointSet &safe, SgBlackWhite color)
 Simple static territory check for surrounded area.
void GoSafetyUtil::ReduceToAnchors (const GoBoard &board, const SgPointSet &stones, SgVector< SgPoint > *anchors)
 Given set of stones, reduce to block anchors.
void GoSafetyUtil::WriteStatistics (const std::string &heading, const GoRegionBoard *regions, const SgBWSet *safe)
 Write statistics about the safe points.

Variables

const bool DEBUG_SAFETY = false
const bool DEBUG_MIGHT_MAKE_LIFE = false
const bool DEBUG_EXTENDED_MIGHT_MAKE_LIFE = false


Function Documentation

bool @18::Find2Connections ( const GoBoard bd,
SgPoint  block,
SgPointSet libs,
SgPointSet usedLibs,
SgPointSet safe 
) [static]

find 2 libs which would connect block to safe.

if found, update libs and safe to indicate that the block is safe now: add block to safe, add block libs to libs, remove the two libs.

Definition at line 33 of file GoSafetyUtil.cpp.

References SgPointSet::Contains(), SgPointSet::Disjoint(), SgPointSet::Include(), SgVector< T >::PushBack(), and SG_ASSERT.

Referenced by Find2ConnectionsForAll().

bool @18::Find2ConnectionsForAll ( const GoBoard bd,
const SgPointSet pts,
const SgPointSet inSafe,
SgBlackWhite  color,
int  maxNuOmissions = 0 
) [static]

Find connections for unsafe boundary and interior stones, and interior empty points.

Can omit maxNuOmissions (0 or 1) empty points from checking. maxNuOmissions = 1 if testing whether opponent can make 2 eyes here, 0 otherwise. Returns bool whether connections were found.

Definition at line 71 of file GoSafetyUtil.cpp.

References GoBoard::All(), GoBoard::AllEmpty(), SgPointSet::Border(), SgVector< T >::Concat(), SgVector< T >::Exclude(), Find2Connections(), GoSafetyUtil::Find2Libs(), GoSafetyUtil::MightMakeLife(), SgVector< T >::NonEmpty(), GoSafetyUtil::ReduceToAnchors(), SgDebug(), SgOppBW(), and GoBoard::Size().

Referenced by GoSafetyUtil::IsTerritory().

void @18::TestLiberty ( SgPoint  lib,
const SgPointSet libs,
SgVector< SgPoint > *  foundLibs,
int *  nuLibs 
) [static]

Definition at line 148 of file GoSafetyUtil.cpp.

References SgPointSet::Contains(), and SgVector< T >::PushBack().

Referenced by GoSafetyUtil::Find2BestLibs(), and GoSafetyUtil::Find2Libs().

void @18::WriteSafeTotal ( std::ostream &  stream,
std::string  text,
int  partCount,
int  totalCount 
) [static]

write part and total and rounded percentage of part in total

Definition at line 160 of file GoSafetyUtil.cpp.

Referenced by GoSafetyUtil::WriteStatistics().


Variable Documentation

const bool DEBUG_EXTENDED_MIGHT_MAKE_LIFE = false [static]

Definition at line 27 of file GoSafetyUtil.cpp.

Referenced by GoSafetyUtil::ExtendedMightMakeLife().

const bool DEBUG_MIGHT_MAKE_LIFE = false [static]

Definition at line 26 of file GoSafetyUtil.cpp.

Referenced by GoSafetyUtil::MightMakeLife().

const bool DEBUG_SAFETY = false [static]

Definition at line 25 of file GoSafetyUtil.cpp.

Referenced by GoSafetyUtil::AddToSafe().


17 Jun 2010 Doxygen 1.4.7