Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- link2(A,Colour,B) :- link(A,Colour,B).
- link2(A,Colour,B) :- link(B,Colour,A).
- %next we define in what order the colours can be
- colourorder(red,brown).
- colourorder(brown,yellow).
- colourorder(yellow,red).
- %then we create a predicate to run through the maze
- route(A,FirstColour,A,List) :-
- %link2(A,FirstColour,B),
- write("completed"),
- append([A],List,FinalList).
- write(FinalList).
- route(A,FirstColour,B,Lists) :-
- link2(A,FirstColour,X),
- colourorder(FirstColour,SecondColour),
- %+member(A,Lists),
- %append(A,Lists,VisitedList),
- route(X,SecondColour,B,VisitedList).
- %finally we create maze to run with route with 'start' as the start point and g as the end.
- %it then output the list
- maze(Start) :-
- route(start,red,g,Start).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement