fork download
  1. adjacent([X,Y],[RX,Y]) :- RX is X -1.
  2. adjacent([X,Y],[RX,Y]) :- RX is X +1.
  3. adjacent([X,Y],[X,RY]) :- RY is Y - 1.
  4. adjacent([X,Y],[X,RY]) :- RY is Y + 1.
  5.  
  6. find_all :-
  7. adjacent([2,2], [X,Y]),
  8. write(X), write(' '), write(Y),nl,
  9.  
  10. find_all.
  11.  
  12. :- find_all.
Success #stdin #stdout 0.02s 6204KB
stdin
Standard input is empty
stdout
1 2
3 2
2 1
2 3