com.b3dgs.lionengine.game.pathfinding
Class ManhattanHeuristic

java.lang.Object
  extended by com.b3dgs.lionengine.game.pathfinding.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


Constructor Summary
ManhattanHeuristic(int minimumCost)
           
 
Method Summary
 float getCost(PathBasedMap<? extends AbstractPathTile> map, Pathfindable mover, int x, int y, int tx, int ty)
          This controls the order in which tiles are searched while attempting to find a path to the target location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManhattanHeuristic

public ManhattanHeuristic(int minimumCost)
Method Detail

getCost

public float getCost(PathBasedMap<? extends AbstractPathTile> map,
                     Pathfindable mover,
                     int x,
                     int y,
                     int tx,
                     int ty)
Description copied from interface: AStarHeuristic
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 - map on which the path is being found.
mover - entity that is moving along the path.
x - x coordinate of the tile being evaluated.
y - y coordinate of the tile being evaluated.
tx - x coordinate of the target location.
ty - y coordinate of the target location.
Returns:
cost associated with the given tile.