|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.monsters.AStarSearch
Implements the standard A* algorithm. Each location visited in the search is assigned a cost and a heuristic value. The nodes are pushed onto a priority queue, and popped off in most-desirable order. The heuristic is customizable.
Nested Class Summary | |
class |
AStarSearch.Node
A node in the search graph. |
Field Summary | |
static int |
BASE_DEPTH
|
static int |
CANT_MOVE
|
static int |
DEFAULT_COST
|
static int |
DIGGABLE_WALL_COST
|
static int |
LOCKED_DOOR_COST
|
static int |
MAX_DEPTH
|
static int |
MAX_INTELLIGENCE
|
static int |
MAX_SEARCH_NODES
|
static int |
PLAYER_MAX_DEPTH
|
static int |
TRAP_COST
|
static int |
UNLOCKED_DOOR_COST
|
Constructor Summary | |
AStarSearch()
Constructs a new AStarSearch |
Method Summary | |
java.lang.String |
computeDirection(int x,
int y)
Quickly computes the direction from the move offsets. |
java.util.List |
constructPath(AStarSearch.Node node)
Returns a list of (String) directions to move to get to the desired player. |
static java.lang.String |
getProfilingInfo()
Returns detailed profiling info. |
boolean |
isGoalNode(AStarSearch.Node node)
Returns true if this is a goal node. |
void |
pushSuccessorNodes(AStarSearch.Node parent)
Generates successors to passed node, computes their costs, and pushes them onto the OPEN list. |
protected void |
reset()
Resets the internal variables so you can call search() again. |
java.util.List |
search(Commandable agent,
GameMap map,
Commandable[] targets)
Executes the A* search to a list of possible targets. |
java.util.List |
search(Commandable agent,
GameMap map,
Point dest)
Executes the A* search to a given destination point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BASE_DEPTH
public static final int MAX_DEPTH
public static final int PLAYER_MAX_DEPTH
public static final int MAX_INTELLIGENCE
public static final int MAX_SEARCH_NODES
public static final int DEFAULT_COST
public static final int UNLOCKED_DOOR_COST
public static final int TRAP_COST
public static final int DIGGABLE_WALL_COST
public static final int LOCKED_DOOR_COST
public static final int CANT_MOVE
Constructor Detail |
public AStarSearch()
Method Detail |
protected void reset()
public final java.util.List search(Commandable agent, GameMap map, Point dest)
agent
- the player or monstermap
- the monster's mapdest
- the desired destination
public final java.util.List search(Commandable agent, GameMap map, Commandable[] targets)
agent
- the monstermap
- the monster's maptargets
- the list of targets under consideration
public final void pushSuccessorNodes(AStarSearch.Node parent)
parent
- the node for which to generate successorspublic boolean isGoalNode(AStarSearch.Node node)
public final java.util.List constructPath(AStarSearch.Node node)
node
- the goal node
public final java.lang.String computeDirection(int x, int y)
x
- x offset (-1, 0, 1)y
- y offset (-1, 0, 1)
public static java.lang.String getProfilingInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |