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; }