General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Hint

Each new step that is taken, has to be remembered. Look at the base case of the recursion (travel(X,Y) :- onestep(X,Y).)first and extend it so that travel records in its third argument that a step from X to Y was taken.

Then look at the recursive rule:

travel(X,Y) :- onestep(X,Z),
               travel(Z,Y).
    
The clause should return a structure representing that a step from X to Z was taken and what is the path that has to be taken to get from Z to Y. This path is computed by the recursive call to the predicate travel.

Solution

Back to the exercise.