Definition in file GoBoardUtil.cpp.
#include "SgSystem.h"
#include "GoBoardUtil.h"
#include <iomanip>
#include <sstream>
#include <string>
#include "GoBoard.h"
#include "GoModBoard.h"
#include "GoMoveExecutor.h"
#include "GoSafetySolver.h"
#include "SgDebug.h"
#include "SgException.h"
#include "SgNbIterator.h"
#include "SgProp.h"
Go to the source code of this file.
Functions | |
void | CfgDistanceCheck (const GoBoard &bd, SgPointArray< int > &array, GoPointList &pointList, int d, SgPoint p) |
Function used in GoBoardUtil::CfgDistance(). | |
void | ScorePositionRecurse (const GoBoard &bd, SgPoint p, const SgPointSet &deadStones, SgMarker &marker, bool &isBlackAdjacent, bool &isWhiteAdjacent, int &nuPoints, int &nuDeadWhite, int &nuDeadBlack) |
Function used in GoBoardUtil::ScorePosition(). | |
void | GoBoardUtil::AddNeighborBlocksOfColor (const GoBoard &bd, SgPoint p, SgBlackWhite color, SgVector< SgPoint > &neighbors) |
Add anchors of neighbor blocks to list. | |
void | GoBoardUtil::AddWall (GoBoard &bd, SgBlackWhite color, SgPoint start, int length, int direction) |
Add wall of stones in color to the board. | |
GoPointList | GoBoardUtil::AdjacentStones (const GoBoard &bd, SgPoint point) |
Get list of stones adjacent to a block. | |
void | GoBoardUtil::AdjacentBlocks (const GoBoard &bd, SgPoint p, int maxLib, SgVector< SgPoint > *blocks) |
SgVector version of GoBoard::AdjacentBlocks. | |
void | GoBoardUtil::BlocksAdjacentToPoints (const GoBoard &bd, const SgVector< SgPoint > &points, SgBlackWhite c, SgVector< SgPoint > *blocks) |
void | GoBoardUtil::BlocksAdjacentToPoints (const GoBoard &bd, const SgPointSet &points, SgBlackWhite c, SgVector< SgPoint > *anchors) |
List the anchors of all blocks of color 'c' adjacent to the region consisting of 'points'. | |
bool | GoBoardUtil::BlockIsAdjacentTo (const GoBoard &bd, SgPoint block, const SgPointSet &walls) |
SgPointArray< int > | GoBoardUtil::CfgDistance (const GoBoard &bd, SgPoint p, int maxDist=std::numeric_limits< int >::max()) |
Compute the common fate graph distance from all points to a given point. | |
void | GoBoardUtil::DumpBoard (const GoBoard &bd, std::ostream &out=SgDebug()) |
Write board including move history to stream. | |
void | GoBoardUtil::ExpandToBlocks (const GoBoard &board, SgPointSet &pointSet) |
Add other stones of blocks to SgPointSet if one is in set. | |
void | GoBoardUtil::DiagonalsOfColor (const GoBoard &bd, SgPoint p, int c, SgVector< SgPoint > *diagonals) |
Get diagonal points with a color. | |
bool | GoBoardUtil::EndOfGame (const GoBoard &bd) |
Return whether the game is finished. | |
bool | GoBoardUtil::GenerateIfLegal (const GoBoard &bd, SgPoint move, SgVector< SgPoint > *moves) |
Include move in list if it is legal. | |
void | GoBoardUtil::GetCoordString (SgMove move, std::string *s, int boardSize) |
Convert the given move to human-readable coordinates. | |
bool | GoBoardUtil::HasAdjacentBlocks (const GoBoard &bd, SgPoint p, int maxLib) |
Return whether block has at least one adjacent opponent block with at most maxLib liberties. | |
bool | GoBoardUtil::IsHandicapPoint (SgGrid size, SgGrid col, SgGrid row) |
bool | GoBoardUtil::IsSimpleEyeOfBlock (const GoBoard &bd, SgPoint lib, SgPoint blockAnchor, const SgVector< SgPoint > &eyes) |
Is lib a simple eye of block? Eyes is a list of other eye points, that do not need to be occupied for lib to be an eye. | |
bool | GoBoardUtil::IsSnapback (const GoBoard &bd, SgPoint p) |
Check if the move just played on p was a snapback. | |
bool | GoBoardUtil::ManySecondaryLibs (const GoBoard &bd, SgPoint block) |
SgSList< SgPoint, 4 > | GoBoardUtil::NeighborsOfColor (const GoBoard &bd, SgPoint p, int c) |
Get adjacent points with a color. | |
void | GoBoardUtil::NeighborsOfColor (const GoBoard &bd, SgPoint p, int c, SgVector< SgPoint > *neighbors) |
Get adjacent points with a color (SgVector version). | |
bool | GoBoardUtil::PassWins (const GoBoard &bd, SgBlackWhite toPlay) |
Check if Tromp-Taylor rules and pass wins. | |
bool | GoBoardUtil::PlayIfLegal (GoBoard &bd, SgPoint p, SgBlackWhite player) |
Play a move if legal. | |
void | GoBoardUtil::ReduceToAnchors (const GoBoard &bd, SgVector< SgPoint > *stones) |
Keep only the anchor of each block in the list. | |
void | GoBoardUtil::ReduceToAnchors (const GoBoard &bd, const SgVector< SgPoint > &stones, SgSList< SgPoint, SG_MAXPOINT > &anchors) |
Keep only the anchor of each block in the list. | |
void | GoBoardUtil::RegionCode (const GoBoard &bd, const SgVector< SgPoint > ®ion, SgHashCode *c) |
Compute the hash code for region of this board position. | |
bool | GoBoardUtil::RemainingChineseHandicap (const GoBoard &bd) |
Returns true iff during the first N moves of a Chinese handicap game. | |
float | GoBoardUtil::ScoreSimpleEndPosition (const GoBoard &bd, float komi, bool noCheck=false) |
Score position with all stones safe and only simple eyes. | |
void | GoBoardUtil::SharedLiberties (const GoBoard &bd, SgPoint block1, SgPoint block2, SgVector< SgPoint > *sharedLibs) |
Return all points that are liberties of both 'block1' and 'block2'. | |
void | GoBoardUtil::SharedLibertyBlocks (const GoBoard &bd, SgPoint anchor, int maxLib, SgVector< SgPoint > *blocks) |
void | GoBoardUtil::UndoAll (GoBoard &bd) |
Undo all moves or setup stones. | |
bool | GoBoardUtil::AtLeastTwoSharedLibs (const GoBoard &bd, SgPoint block1, SgPoint block2) |
Return whether 'block1' and 'block2' have at least two shared liberties. | |
void | GoBoardUtil::TestForChain (GoBoard &bd, SgPoint block, SgPoint block2, SgPoint lib, SgVector< SgPoint > *extended) |
bool | GoBoardUtil::HasStonesOfBothColors (const GoBoard &bd, const SgVector< SgPoint > &stones) |
bool | GoBoardUtil::MoveNotLegalOrAtari (GoBoard &bd, SgPoint move) |
Either move is not legal, or the block at move is in atari after the move. | |
bool | GoBoardUtil::MoveLegalAndNotAtari (GoBoard &bd, SgPoint move) |
Move is legal and the block at move is not in atari after the move. | |
bool | GoBoardUtil::ScorePosition (const GoBoard &bd, const SgPointSet &deadStones, float &score) |
Count score given the set of dead stones. | |
int | GoBoardUtil::Stones (const GoBoard &bd, SgPoint p, SgPoint stones[]) |
Fill stones in an array. | |
bool | GoBoardUtil::TwoPasses (const GoBoard &bd) |
Check if the last two moves were two passes in a row, the first pass by the current color to play, the second by the opponent. | |
SgPointSet | GoBoardUtil::Lines (const GoBoard &bd, SgGrid from, SgGrid to) |
all points on lines [from. | |
SgRect | GoBoardUtil::GetDirtyRegion (const GoBoard &bd, SgMove move, SgBlackWhite color, bool checklibs=false, bool premove=false) |
Which intersections were modified with the last move. | |
int | GoBoardUtil::Approx2Libs (const GoBoard &board, SgPoint block, SgPoint p, SgBlackWhite color) |
Estimate second order liberties of point p for given block This is fast and approximate, may double count libs. | |
std::ostream & | operator<< (std::ostream &out, const GoBoardWrite::WriteMap &w) |
void @3::CfgDistanceCheck | ( | const GoBoard & | bd, | |
SgPointArray< int > & | array, | |||
GoPointList & | pointList, | |||
int | d, | |||
SgPoint | p | |||
) | [static] |
Function used in GoBoardUtil::CfgDistance().
Definition at line 30 of file GoBoardUtil.cpp.
References GoBoard::Anchor(), GoBoard::IsBorder(), GoBoard::Occupied(), and SgSList< T, SIZE >::PushBack().
Referenced by GoBoardUtil::CfgDistance().
std::ostream& operator<< | ( | std::ostream & | out, | |
const GoBoardWrite::WriteMap & | w | |||
) |
Definition at line 964 of file GoBoardUtil.cpp.
void @3::ScorePositionRecurse | ( | const GoBoard & | bd, | |
SgPoint | p, | |||
const SgPointSet & | deadStones, | |||
SgMarker & | marker, | |||
bool & | isBlackAdjacent, | |||
bool & | isWhiteAdjacent, | |||
int & | nuPoints, | |||
int & | nuDeadWhite, | |||
int & | nuDeadBlack | |||
) | [static] |
Function used in GoBoardUtil::ScorePosition().
Definition at line 46 of file GoBoardUtil.cpp.
References SgPointSet::Contains(), GoBoard::GetColor(), GoBoard::IsBorder(), SgMarker::NewMark(), SG_BLACK, SG_EMPTY, SG_NS, SG_WE, and SG_WHITE.
Referenced by GoBoardUtil::ScorePosition().