00001
00002
00003
00004
00005
00006
00007 #ifndef GO_SAFETYUTIL_H
00008 #define GO_SAFETYUTIL_H
00009
00010 #include "SgBlackWhite.h"
00011 #include "SgMiaiStrategy.h"
00012 #include "SgPoint.h"
00013 #include "SgVector.h"
00014
00015 class GoBoard;
00016 class GoRegion;
00017 class GoRegionBoard;
00018 class SgBWSet;
00019 class SgPointSet;
00020
00021
00022
00023 namespace GoSafetyUtil
00024 {
00025
00026
00027 void AddToSafe(const GoBoard& board, const SgPointSet& pts,
00028 SgBlackWhite color, SgBWSet* safe, const char* reason,
00029 int depth, bool addBoundary);
00030
00031
00032
00033
00034
00035 bool ExtendedIsTerritory(const GoBoard& board, GoRegionBoard* regions,
00036 const SgPointSet& pts,
00037 const SgPointSet& safe, SgBlackWhite color);
00038
00039
00040 SgPointSet FindDamePoints(const GoBoard& board, const SgPointSet& empty,
00041 const SgBWSet& safe);
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 void FindDameAndUnsurroundablePoints(const GoBoard& bd,
00055 const SgPointSet& empty,
00056 const SgBWSet& safe,
00057 SgPointSet* dame,
00058 SgPointSet* unsurroundable);
00059
00060
00061 bool IsTerritory(const GoBoard& board, const SgPointSet& pts,
00062 const SgPointSet& safe, SgBlackWhite color);
00063
00064
00065 void ReduceToAnchors(const GoBoard& board, const SgPointSet& stones,
00066 SgVector<SgPoint>* anchors);
00067
00068
00069
00070
00071
00072 bool Find2Libs(SgPoint p, SgPointSet* libs);
00073
00074
00075
00076
00077
00078 bool Find2BestLibs(SgPoint p, const SgPointSet& libs,
00079 SgPointSet interior, SgMiaiPair* miaiPair);
00080
00081
00082
00083
00084
00085 bool ExtendedMightMakeLife(const GoBoard& board, GoRegionBoard* regions,
00086 const SgPointSet& area, const SgPointSet& safe,
00087 SgBlackWhite color);
00088
00089
00090
00091
00092
00093 bool MightMakeLife(const GoBoard& board, const SgPointSet& area,
00094 const SgPointSet& safe, SgBlackWhite color);
00095
00096
00097 void WriteStatistics(const std::string& heading,
00098 const GoRegionBoard* regions,
00099 const SgBWSet* safe);
00100
00101 }
00102
00103
00104
00105 #endif // GO_SAFETYUTIL_H