fork download
  1. :- set_prolog_flag(verbose,silent).
  2. :- prompt(_, '').
  3. :- use_module(library(readutil)).
  4.  
  5. test([(_,_)],[]).
  6. test([A|P],List):-
  7. B=(_,_),
  8. append([B],_,P),
  9. vizinha(A,B,Dir),
  10. append([Dir],List1,List),
  11. test(P,List1).
  12.  
  13. /* Para testar */
  14. vizinha((5,5),(5,6),0).
  15. vizinha((5,6),(6,6),90).
  16. vizinha((6,6),(6,7),0).
  17. vizinha((6,7),(7,7),90).
  18.  
  19. main:-
  20. process,
  21.  
  22. process:-
  23. test([ (5, 5), (5, 6), (6, 6), (6, 7), (7, 7)],L),
  24. write(L),
  25. nl,
  26.  
  27. :- main.
Success #stdin #stdout 0.02s 7744KB
stdin
Standard input is empty
stdout
[0,90,0,90]