org.newdawn.slick.util.pathfinding.heuristics
Class ClosestSquaredHeuristic

java.lang.Object
  extended by org.newdawn.slick.util.pathfinding.heuristics.ClosestSquaredHeuristic
All Implemented Interfaces:
AStarHeuristic

public class ClosestSquaredHeuristic
extends java.lang.Object
implements AStarHeuristic

A heuristic that uses the tile that is closest to the target as the next best tile. In this case the sqrt is removed and the distance squared is used instead

Author:
Kevin Glass

Constructor Summary
ClosestSquaredHeuristic()
           
 
Method Summary
 float getCost(TileBasedMap map, Mover mover, int x, int y, int tx, int ty)
          Get the additional heuristic cost of the given tile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClosestSquaredHeuristic

public ClosestSquaredHeuristic()
Method Detail

getCost

public float getCost(TileBasedMap map,
                     Mover mover,
                     int x,
                     int y,
                     int tx,
                     int ty)
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 found
mover - The entity that is moving along the path
x - The x coordinate of the tile being evaluated
y - The y coordinate of the tile being evaluated
tx - The x coordinate of the target location
ty - 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)


Copyright © 2006 New Dawn Software. All Rights Reserved.