Arguments not sufficiently instantiated in Prolog error

62 Views Asked by At

As the title suggests, I am having an error I don't really know how to fix as I am quite new to prolog and was wondering if someone could point out a solution?

I wrote some code to find paths between certain points. Here is my code

edge(o,p1).
edge(p1,k).
edge(k,l).
edge(l,c).
edge(c,b).
edge(c,w).
edge(c,m).
edge(l,p2).


path(X,Y,Path) :- path(X,Y,[X],Q), reverse(Q,Path).


path(X,Y,Visited,[Y|Visited]) :- edge(X,Y).
path(X,Y,Visited,Path) :-
    edge(X,Z),
    Z \== Y,
    \+ member(Z,Visited),
    path(Z,Y,[Z|Visited],Path).

Error message I get when I try to compile: Arguments are not sufficiently Instantiated

Edit the errors: image here of error

0

There are 0 best solutions below