I have been working on this all day and developed it to here:
% Load in the tube file.
:-[tube].
% route takes a starting location'X' and a destination 'Z'.
% Creates an empty list and calls getroute.
route(X,Z):-
getroute(X,Z,[X]).
% getroute takes a starting location 'X'...
I don't understand what your attempting.
You want:
minus(A,B)
Where both A and B are lists? And then it prints out what you would have to take away from A to get to B?
I have been playing with the code and I believe this should work, but it fails in exactly the same way as my last post:
% Load in the tube file.
:-[tube].
% route takes a starting location'X' and a destination 'Z'.
% Creates an empty list 'V' and calls getroute.
route(X,Z):-
V...
This is what I have intended to do. But adding a list to my code seems to break it. Just slowly implementing this, I haven't added the code to add stations into the list, just pass the list around:
route(X,Z):-
V = [],
getroute(X,Z,V).
getroute(X,Z,V) :-...
I have a file containing how stations in the London underground are linked.
For example:
% CIRCLE LINE
connected(high_st_kensington,notting_hill_gate,circle).
connected(notting_hill_gate,bayswater,circle).
% NORTHERN LINE (left branch)
connected(mornington_crescent,euston,northern_l)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.