Package model.util

Class PathFinder

java.lang.Object
model.util.PathFinder

public class PathFinder extends Object
  • Constructor Details

    • PathFinder

      public PathFinder(Buildable[][] map)
  • Method Details

    • euclideanDistance

      public double euclideanDistance(Buildable start, Buildable goal) throws NullPointerException
      Calculates the euclidean distance between two buildable
      Parameters:
      start - the starting buildable
      goal - the goal buildable
      Returns:
      the euclidean distance
      Throws:
      NullPointerException - if one of the parameter is null.
    • squareDistance

      public double squareDistance(Buildable start, Buildable goal) throws NullPointerException
      Calculates max difference between two buildable
      Parameters:
      start - the starting buildable
      goal - the goal buildable
      Returns:
      the euclidean distance
      Throws:
      NullPointerException - if one of the parameter is null.
    • manhattanDistance

      public int manhattanDistance(Buildable start, Buildable goal)
      Calculates the manhattan distance between two buildable
      Parameters:
      start - the starting buildable
      goal - the goal buildable
      Returns:
      the manhattan distance