|
|||||||||||
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.safety.simplesafety.SimpleSafety
This module implements the Safety interface. Its job is to determine the safety of each loose group on the board. By necessity, this is a very simplistic analysis, which can be refined by subsequent modules.
Field Summary | |
private static float |
ADEQUATESAFETY
Groups which are rated more safe than this do not need any defending. |
private Board |
board
The Board module which this module uses. |
private static DebugType[] |
dt
The debug types which this module supports. |
private Geometry |
geometry
The Geometry module which this module uses. |
private boolean |
isGenerated
This is true after generateMove() is called, but before makeMove() is called. |
private LooseGroups |
lg
The LooseGroups module which this module uses. |
private static float |
MINSAFETY
The minimum safety required for a group to be considered worth saving. |
private ModuleType[] |
mt
The types of modules which this module requires. |
private RatedMove[] |
rm
The rated move which the generateMove() method produces. |
private HashMap |
safety
The key is a LooseGroup, and the value is a Float. |
Fields inherited from class org.moyoman.module.Module |
|
Fields inherited from interface org.moyoman.module.safety.Safety |
CONFIDENCE |
Constructor Summary | |
SimpleSafety(GameId id,
ModuleName name)
Create the SimpleSafety module. |
Method Summary | |
Object |
clone()
Override the Object.clone() method. |
private static float |
computeSafety(SingleLooseGroup slg,
Board b,
LooseGroups lg,
Geometry geo)
Compute the safety for a loose group. |
private RatedMove[] |
evaluate(Board b,
LooseGroups lg,
Geometry geo)
Determine the safety of each loose group on the board, and produce rated moves. |
void |
generateMove(Module[] modules)
Generate the move for this module. |
private Set |
getBoundaryPoints(SingleLooseGroup slg,
double strength,
Board b,
Geometry geo)
Get the points of approximately equal distance between the loose group and other loose groups. |
Debug[] |
getDebugInformation(DebugType[] types)
Return the debug information for this module. |
DebugType[] |
getDebugTypes()
Return the types of debug information that this module supports. |
private void |
getExtendingMoves(SingleLooseGroup curr,
double strength,
Board b,
Geometry geo,
int fcount,
int ecount,
HashMap moves)
Find those moves which extends into the points closest to another loose group. |
RatedMove[] |
getMoves()
Return the moves generated by the module. |
ModuleType[] |
getRequiredModuleList()
Return the modules that this module requires to perform its task. |
float |
getSafety(SingleLooseGroup slg)
Get the safety for a loose group. |
private double |
getStrength(SingleLooseGroup slg)
Get the strength of a loose group. |
void |
makeMove(Move move,
Module[] modules)
Update the internal data structures of this module with the new move. |
Methods inherited from class org.moyoman.module.Module |
checkTime, create, createHelper, debug, error, error, fatal, fatal, getAllHelpers, getHelper, getId, getKomi, getModule, getModuleName, getScheduler, information, 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 final float MINSAFETY
private static final float ADEQUATESAFETY
private static DebugType[] dt
private ModuleType[] mt
private RatedMove[] rm
private Board board
private Geometry geometry
private LooseGroups lg
private HashMap safety
private boolean isGenerated
Constructor Detail |
public SimpleSafety(GameId id, ModuleName name) throws InternalErrorException
id
- The id of the game.name
- The name of this module.
InternalErrorException
- Thrown if the operation fails for any reason.Method Detail |
public void generateMove(Module[] modules)
generateMove
in class Module
modules
- An array of modules which this module needs
in order to perform its work. Those modules reflect the
current state of the board but are copies of the actual modules,
so this method is free to manipulate them.private RatedMove[] evaluate(Board b, LooseGroups lg, Geometry geo)
b
- The Board module.lg
- The LooseGroups module.geo
- The Geometry module.
private double getStrength(SingleLooseGroup slg)
slg
- The loose group.
private void getExtendingMoves(SingleLooseGroup curr, double strength, Board b, Geometry geo, int fcount, int ecount, HashMap moves)
curr
- The loose group for which the moves are found.strength
- The strength of this group.b
- The Board modulegeo
- The Geometry modulefcount
- The number of friendly loose groups on the board.ecount
- The number of enemy loose groups on the board.private Set getBoundaryPoints(SingleLooseGroup slg, double strength, Board b, Geometry geo)
slg
- The loose group.strength
- The strength of the loose group.b
- The Board module.geo
- The Geometry module.
public Debug[] getDebugInformation(DebugType[] types)
getDebugInformation
in class Module
types
- Only return Debug objects that are one of the debug types in this array.
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)
makeMove
in class Module
move
- The move that was just made.modules
- The modules that this method needs to perform its job.private static float computeSafety(SingleLooseGroup slg, Board b, LooseGroups lg, Geometry geo)
slg
- The loose group.
public float getSafety(SingleLooseGroup slg)
getSafety
in interface Safety
slg
- The loose group in question.
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 |