mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Add a heuristic using euclidean distance for cost
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user