Collection of useful utilities for Java games and apps. A lot of interesting utilities that could maybe still find some use if you work with Java...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mightyutils/src/mightypork/utils/math/algo/pathfinding/heuristics/ManhattanHeuristic.java

15 lines
348 B

package mightypork.utils.math.algo.pathfinding.heuristics;
import mightypork.utils.math.algo.Coord;
import mightypork.utils.math.algo.pathfinding.Heuristic;
public class ManhattanHeuristic extends Heuristic {
@Override
public double getCost(Coord pos, Coord target)
{
return Math.abs(target.x - pos.x) + Math.abs(target.y - pos.y);
}
}