Implementing Heuristics

For simple problems like the bridge, FWGC and water jug problem, it is not necessary to come up with a heuristic function — breadth-first search is entirely adequate.

However, BridgeState, FarmerState and WaterJugState must still define a default getHeuristic method:

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

Now states will come off the priority queue in no particular order during best-first search.

When we fix the search algorithm later this default heuristic will result in an optimal breadth-first search for these simple problems.