Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- path(Start, Dest, [[Start,Dest]]) :- connected(Start, Dest).
- path(Start, Dest, [[Start, Waypoint]|Path]) :- dif(Dest, Waypoint),
- connected(Start, Waypoint), path(Waypoint, Dest, Path).
- alldifferent(_,[]).
- alldifferent(X,[L|Ls]) :- dif(X,L), alldifferent(X,Ls).
- pathaux(Start, Dest, [Start,Dest],Q) :- connected(Start, Dest), alldifferent(Start,Q).
- pathaux(Start, Dest, [Start, Waypoint|Path],Q) :- dif(Dest, Waypoint),
- connected(Start, Waypoint),
- pathaux(Waypoint, Dest, Path, [Start|Q]), alldifferent(Start,Q).
- path(X,Y,Z) :- pathaux(X,Y,Z,[]).
- connected(ataba,naguib).
- connected(naguib,sadat).
- connected(sadat,opera).
- connected(opera,dokki).
- connected(opera,ataba). //Note this one
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement