public XYLocation getLocationOf(int val) { int absPos = getPositionOf(val); return new XYLocation(getXCoord(absPos), getYCoord(absPos)); }
public double h(Object state) { EightPuzzleBoard board = (EightPuzzleBoard)state; int retVal = 0; for (int i = 1; i < 9; i++) { XYLocation loc = board.getLocationOf(i); retVal += evaluateManhattanDistanceOf(i, loc); } return(retVal); }