zombie.ai.astar.heuristics
Class ManhattanHeuristic
java.lang.Object
zombie.ai.astar.heuristics.ManhattanHeuristic
- All Implemented Interfaces:
- AStarHeuristic
public class ManhattanHeuristic
- extends java.lang.Object
- implements AStarHeuristic
A heuristic that drives the search based on the Manhattan distance
between the current location and the target
- Author:
- Kevin Glass
|
Method Summary |
float |
getCost(TileBasedMap map,
Mover mover,
int x,
int y,
int z,
int tx,
int ty,
int tz)
get the additional heuristic cost of the given tile. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ManhattanHeuristic
public ManhattanHeuristic(int minimumCost)
- Create a new heuristic
- Parameters:
minimumCost - The minimum movement cost from any one square to the next
getCost
public float getCost(TileBasedMap map,
Mover mover,
int x,
int y,
int z,
int tx,
int ty,
int tz)
- Description copied from interface:
AStarHeuristic
- get the additional heuristic cost of the given tile. This controls the
order in which tiles are searched while attempting to find a path to the
target location. The lower the cost the more likely the tile will
be searched.
- Specified by:
getCost in interface AStarHeuristic
- Parameters:
map - The map on which the path is being foundmover - The entity that is moving along the pathx - The x coordinate of the tile being evaluatedy - The y coordinate of the tile being evaluatedtx - The x coordinate of the target locationty - Teh y coordinate of the target location
- Returns:
- The cost associated with the given tile
- See Also:
AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)