Implementing Heuristics

Heuristics are a property of states, so they should be computed by classes that implement the State interface.

Therefore we add a getHeuristic method to the State interface: State.java.

For PuzzleState we implement heuristics like this:

    public int getHeuristic(State goal) {
        return tilesOutOfPlace(goal);
    }

    private int tilesOutOfPlace(State goal) {
       ...
    }