|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A class that implements this interface will be computing geometrical information about the board. This includes information such as which empty points are closest to a given loose group, which stones and points make up the convex hull of a set of points, and which groups are adjacent to, or enclosed by a loose group.
There are two different methods for computing the convex hull, one that uses associated edge points, and one that does not. See the LooseGroups module documentation for an explanation of associated edge points. Consider a two space extension on the third line from a stone on the third line as an example. The getConvexHull() method would just return the two stones. The getConvexHullWithEdgePoints() method would return the two stones, as well as the two stones on the edge directly beneath the two stones, which would form a rectangle with four empty points inside.
Field Summary | |
static float |
CONFIDENCE
|
Method Summary | |
boolean |
areLooseGroupsAdjacent(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Determine if two loose groups are adjacent to each other. |
SingleLooseGroup[] |
getAdjacentGroups(SingleLooseGroup slg)
Get all of the groups which are adjacent to the specified group. |
Point[] |
getBorderPointsBetweenGroups(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Return the empty points midway between two adjacent loose groups. |
Point[] |
getClosestEmptyPoints(SingleLooseGroup slg)
Get the empty points that are as close or closer to the specified group than to any other. |
HashMap |
getClosestStones(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Get the closest stones between two loose groups. |
Point[] |
getClosestUniqueEmptyPoints(SingleLooseGroup slg)
Get the empty points that are closer to the specified group than to any other. |
ConvexHull |
getConvexHull(Point[] points)
Get the convex hull for the specified points. |
ConvexHull |
getConvexHull(SingleLooseGroup slg)
Return the convex hull of the specified group. |
ConvexHull |
getConvexHullByColor(Stone stone)
Get the convex hull for all of the adjacent stones of the same color as the specified stone. |
ConvexHull |
getConvexHullWithEdgePoints(SingleLooseGroup slg)
Return the convex hull of the specified group. |
short |
getDistanceToClosestStone(Point pt)
Determine the distance from the point to the nearest stone. |
SingleLooseGroup[] |
getEnclosedGroups(SingleLooseGroup slg)
Return all of the groups which are enclosed by the specified group. |
Point[] |
getPointsBetweenGroups(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Return the empty points between two adjacent loose groups. |
SingleLooseGroup[] |
getSingleLooseGroups(Point pt)
Get all of the loose groups which are closest to the given point. |
int |
getTotalClosestEmptyPoints(SingleLooseGroup slg)
Get the number of points which are closer to this group than any other. |
float |
getTotalUniqueClosestEmptyPoints(SingleLooseGroup slg)
Get the number of points which are closer to this group than any other. |
boolean |
isAdjacentToCorner(SingleLooseGroup slg)
Determine if the loose group is adjacent to any corner of the board. |
boolean |
isAdjacentToSide(SingleLooseGroup slg)
Determine if the loose group is adjacent to any side of the board. |
Methods inherited from interface org.moyoman.module.ModuleInterface |
clone, getMoves, getScheduler |
Field Detail |
public static final float CONFIDENCE
Method Detail |
public SingleLooseGroup[] getAdjacentGroups(SingleLooseGroup slg)
slg
- The SingleLooseGroup in question.
public SingleLooseGroup[] getEnclosedGroups(SingleLooseGroup slg)
slg
- The SingleLooseGroup in question.
public ConvexHull getConvexHull(SingleLooseGroup slg)
A convex hull is a standard geometrical concept. Basically, if a wooden board had pins placed in it that represented the stones, and a rubber band was stretched so that all of the pins were inside, the shape that the rubber band assumes is the convex hull. This method should return the maximal set of stones on the convex hull. See the book, Algorithms, by Robert Sedgewick for more details.
slg
- The SingleLooseGroup in question.
public ConvexHull getConvexHull(Point[] points)
public ConvexHull getConvexHullByColor(Stone stone) throws NoSuchDataException
stone
- The specified stone.
NoSuchDataException
- Thrown if the stone is not on the board.public ConvexHull getConvexHullWithEdgePoints(SingleLooseGroup slg)
A convex hull is a standard geometrical concept. Basically, if a wooden board had pins placed in it that represented the stones, and a rubber band was stretched so that all of the pins were inside, the shape that the rubber band assumes is the convex hull. This method should return the maximal set of stones and points on the convex hull. See the book, Algorithms, by Robert Sedgewick for more details.
slg
- The SingleLooseGroup in question.
public Point[] getClosestEmptyPoints(SingleLooseGroup slg)
slg
- The SingleLooseGroup in question.
public Point[] getClosestUniqueEmptyPoints(SingleLooseGroup slg)
slg
- The SingleLooseGroup in question.
public Point[] getPointsBetweenGroups(SingleLooseGroup slg1, SingleLooseGroup slg2) throws IllegalArgumentException
slg1
- One of the loose groups.slg2
- The other loose group.
IllegalArgumentException
- Thrown if the two groups are not adjacent.public Point[] getBorderPointsBetweenGroups(SingleLooseGroup slg1, SingleLooseGroup slg2) throws IllegalArgumentException
IllegalArgumentException
public SingleLooseGroup[] getSingleLooseGroups(Point pt)
pt
- The point in question.
public float getTotalUniqueClosestEmptyPoints(SingleLooseGroup slg)
slg
- The SingleLooseGroup in question.
public int getTotalClosestEmptyPoints(SingleLooseGroup slg)
slg
- The SingleLooseGroup in question.
public HashMap getClosestStones(SingleLooseGroup slg1, SingleLooseGroup slg2)
This distance is measured without taking into account whether there are any stones of other loose groups in between, so it is not an error to call this method on two loose groups which are not adjacent to each other.
slg1
- The first loose group
public boolean isAdjacentToSide(SingleLooseGroup slg)
slg
- The loose group.
public boolean isAdjacentToCorner(SingleLooseGroup slg)
slg
- The loose group.
public boolean areLooseGroupsAdjacent(SingleLooseGroup slg1, SingleLooseGroup slg2)
So as an example, in a cross cut there are four groups. Each black stone is adjacent to the two loose groups containing a white stone, but not to the loose group containing the other black stone.
slg1
- The first loose group
public short getDistanceToClosestStone(Point pt)
pt
- The point in question.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |