|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.module.Module | +--org.moyoman.module.geometry.geometryimpl.GeometryImpl
Compute geometric information about the board, such as the set of empty points which are closer to a group than any other, which groups are adjacent to which other groups, and the convex hull of each group.
Field Summary | |
private Board |
board
The Board module. |
private ClosestPoints |
cp
This class helps in computing geometrical information. |
private static DebugType[] |
dt
The debug types that this module generates. |
(package private) GeometryMoveGenerator |
gmg
This is used to generate the move. |
private boolean |
isGenerated
If true, then the last move was generated. |
private LooseGroups |
lg
The LooseGroups module. |
private static ModuleType[] |
mt
The module types that this module is dependent on. |
private RatedMove[] |
ratedMoves
The rated moves that generateMove() generates. |
Fields inherited from class org.moyoman.module.Module |
|
Fields inherited from interface org.moyoman.module.geometry.Geometry |
CONFIDENCE |
Constructor Summary | |
GeometryImpl(GameId id,
ModuleName name)
Create a new GeometryImpl object. |
Method Summary | |
boolean |
areLooseGroupsAdjacent(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Determine if the two loose groups are adjacent. |
private int |
calculateTotalGroups(Color col,
LooseGroups lg)
|
private boolean |
checkEdge(Point pt,
Point[] points)
Check if the point in question is on an edge of the polygon. |
Object |
clone()
Override the Object.clone() method. |
protected int |
computeDistance(Point pt1,
Point pt2)
Compute the distance between the two points. |
protected void |
error(Exception e)
Provide a method for logging errors for other classes in this package. |
void |
generateMove(Module[] modules)
Generate moves based on geometric analysis. |
SingleLooseGroup[] |
getAdjacentGroups(SingleLooseGroup slg)
Get all of the groups which are adjacent to the specified group. |
Point[] |
getBorderPointsBetweenGroups(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Get the points midway between the two loose groups. |
Point[] |
getClosestEmptyPoints(SingleLooseGroup slg)
Get the empty points that are as close to the specified group as any other. |
HashMap |
getClosestStones(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Find pairs of stones from the two loose groups that are closer than any others. |
Point[] |
getClosestUniqueEmptyPoints(SingleLooseGroup slg)
Get the empty points that are closer to the specified group than 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, including implied edge points. |
Debug[] |
getDebugInformation(DebugType[] types)
Get the debug information for this module. |
DebugType[] |
getDebugTypes()
Get the debug types that this module produces. |
short |
getDistanceToClosestStone(Point pt)
Determine the distance from the given point to the nearest stone. |
SingleLooseGroup[] |
getEnclosedGroups(SingleLooseGroup slg)
Return all of the groups which are enclosed by the specified group. |
RatedMove[] |
getMoves()
Get the rated moves that this module generates. |
Point[] |
getPointsBetweenGroups(SingleLooseGroup slg1,
SingleLooseGroup slg2)
Get the empty points between the two adjacent loose groups. |
ModuleType[] |
getRequiredModuleList()
Get the module types that this module requires. |
SingleLooseGroup[] |
getSingleLooseGroups(Point pt)
Get 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. |
void |
information(String msg)
Provide a method for logging messages for other classes in this package. |
boolean |
isAdjacentToCorner(SingleLooseGroup slg)
Determine if the loose group is adjacent to any of the corners of the board. |
boolean |
isAdjacentToSide(SingleLooseGroup slg)
Determine if the loose group is adjacent to any of the sides of the board. |
void |
makeMove(Move move,
Module[] modules)
Update this module with the last move made. |
Methods inherited from class org.moyoman.module.Module |
checkTime, create, createHelper, debug, error, fatal, fatal, getAllHelpers, getHelper, getId, getKomi, getModule, getModuleName, getScheduler, setTime, warning, warning |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.moyoman.module.ModuleInterface |
getScheduler |
Field Detail |
private static ModuleType[] mt
private static DebugType[] dt
private RatedMove[] ratedMoves
private ClosestPoints cp
private Board board
private LooseGroups lg
private boolean isGenerated
GeometryMoveGenerator gmg
Constructor Detail |
public GeometryImpl(GameId id, ModuleName name) throws InternalErrorException
id
- The id of the game.name
- The name of this module.
InternalErrorException
- Thrown if an error occurs for any reason.Method Detail |
public SingleLooseGroup[] getAdjacentGroups(SingleLooseGroup slg)
getAdjacentGroups
in interface Geometry
slg
- The SingleLooseGroup in question.
public SingleLooseGroup[] getEnclosedGroups(SingleLooseGroup slg)
getEnclosedGroups
in interface Geometry
slg
- The SingleLooseGroup in question.
public ConvexHull getConvexHull(SingleLooseGroup slg)
getConvexHull
in interface Geometry
slg
- The SingleLooseGroup in question.
public ConvexHull getConvexHullWithEdgePoints(SingleLooseGroup slg)
In addition to using the stones in the loose group, points on the edge are also used if they are associated with the group. This is determined by the loose groups module.
getConvexHullWithEdgePoints
in interface Geometry
slg
- The SingleLooseGroup in question.
public ConvexHull getConvexHull(Point[] points)
Geometry
getConvexHull
in interface Geometry
public ConvexHull getConvexHullByColor(Stone stone) throws NoSuchDataException
Geometry
getConvexHullByColor
in interface Geometry
stone
- The specified stone.
NoSuchDataException
- Thrown if the stone is not on the board.public short getDistanceToClosestStone(Point pt)
getDistanceToClosestStone
in interface Geometry
pt
- The point in question.
private boolean checkEdge(Point pt, Point[] points) throws IllegalArgumentException
pt
- The point in question.points
- The vertices of the polygon.
IllegalArgumentException
- Thrown if the point is not on an edge.public Point[] getClosestEmptyPoints(SingleLooseGroup slg)
getClosestEmptyPoints
in interface Geometry
slg
- The loose group in question.
public Point[] getClosestUniqueEmptyPoints(SingleLooseGroup slg)
getClosestUniqueEmptyPoints
in interface Geometry
slg
- The loose group in question.
public Point[] getPointsBetweenGroups(SingleLooseGroup slg1, SingleLooseGroup slg2) throws IllegalArgumentException
getPointsBetweenGroups
in interface Geometry
slg1
- One of the loose groups.slg2
- The other loose group.
IllegalArgumentException
- Thrown if the two loose groups are not adjacent.public Point[] getBorderPointsBetweenGroups(SingleLooseGroup slg1, SingleLooseGroup slg2) throws IllegalArgumentException
getBorderPointsBetweenGroups
in interface Geometry
slg1
- One of the loose groups.slg2
- The other loose group.
IllegalArgumentException
- Thrown if the two loose groups are not adjacent.protected int computeDistance(Point pt1, Point pt2)
pt1
- A point.pt2
- The other point.
public HashMap getClosestStones(SingleLooseGroup slg1, SingleLooseGroup slg2)
getClosestStones
in interface Geometry
slg1
- A loose groupslg2
- Another loose group
public SingleLooseGroup[] getSingleLooseGroups(Point pt)
getSingleLooseGroups
in interface Geometry
pt
- The point in question.
public float getTotalUniqueClosestEmptyPoints(SingleLooseGroup slg)
getTotalUniqueClosestEmptyPoints
in interface Geometry
slg
- The SingleLooseGroup in question.
public int getTotalClosestEmptyPoints(SingleLooseGroup slg)
getTotalClosestEmptyPoints
in interface Geometry
slg
- The SingleLooseGroup in question.
public boolean isAdjacentToSide(SingleLooseGroup slg)
isAdjacentToSide
in interface Geometry
slg
- The loose group.
public boolean isAdjacentToCorner(SingleLooseGroup slg)
isAdjacentToCorner
in interface Geometry
slg
- The loose group.
public boolean areLooseGroupsAdjacent(SingleLooseGroup slg1, SingleLooseGroup slg2)
areLooseGroupsAdjacent
in interface Geometry
slg1
- One of the loose groups.slg2
- The other loose group.
public void generateMove(Module[] modules)
generateMove
in class Module
modules
- The modules required by this module.private int calculateTotalGroups(Color col, LooseGroups lg)
public Debug[] getDebugInformation(DebugType[] types)
getDebugInformation
in class Module
types
- The debug types that the caller can process.
public DebugType[] getDebugTypes()
getDebugTypes
in class Module
public RatedMove[] getMoves()
getMoves
in interface ModuleInterface
getMoves
in class Module
public ModuleType[] getRequiredModuleList()
getRequiredModuleList
in class Module
public void makeMove(Move move, Module[] modules) throws InternalErrorException
makeMove
in class Module
move
- The move that was last made.modules
- The modules that this module requires.
InternalErrorException
- Thrown if the operation fails for any reason.protected void error(Exception e)
error
in class Module
e
- The exception to be logged.public void information(String msg)
information
in class Module
msg
- The message to log.public Object clone()
clone
in interface ModuleInterface
clone
in class Module
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |