Add a heuristic using euclidean distance for cost

This commit is contained in:
Gary Tierney
2016-02-09 23:41:15 +00:00
parent 1ef364beb8
commit bea2e61b27
@@ -0,0 +1,17 @@
package org.apollo.game.model.entity.path;
import org.apollo.game.model.Position;
/**
* A heuristic which uses <i>Euclidean</i> distance to calculate the cost for a movement.
*/
public final class EuclideanHeuristic extends Heuristic {
/**
* @see Position#getDistance(Position)
*/
@Override
public int estimate(Position current, Position target) {
return current.getDistance(target);
}
}