I'm learning Prolog, and I'm getting creep error when I try to find a route. I think what I did is recursion because that's the way to find a route when there's not a straight path.
Here is the code:
route(london,paris).
route(paris,rome).
route(rome,spain).
route(london,berlin).
route(berlin,praga).
route(london,dublin).
route(dublin,berlin).
path(X,Y,[X,Y]):- straight(X,Y).
path(X,Z,[X | other]):- straight(X,Y), path(Y,Z,other).
when I try to find, let's say the route from London to Rome
path(london,rome,Store).
I get this error:
Exception: (8) straight(london, rome) ? creep
Exception: (7) path(london, rome, _G4705) ? creep
What am I doing wrong? Should I define something else?
Thanks in advance!