fork download
  1.  
  2.  
  3. queens(N, Qs) :- length(Qs, N), Qs ins 1..N, safeColumn(Qs), labeling([ffc], Qs).
  4.  
  5. safeColumn([]).
  6. safeColumn([Q|Qs]) :- safeColumn(Qs, Q, 1), safeColumn(Qs).
  7.  
  8. safeColumn([],_,_).
  9. safeColumn([Q|Qs], SelQ, Diagoff) :- SelQ #\= Q, abs(SelQ - Q) #\= Diagoff, Diagoff1 #= Diagoff + 1, safeColumn(Qs, SelQ, Diagoff1).
Success #stdin #stdout #stderr 0.03s 6904KB
stdin
queens(6, L).
stdout
Standard output is empty
stderr
ERROR: /home/zZWsku/prog:3:35: Syntax error: Operator expected
ERROR: /home/zZWsku/prog:9:42: Syntax error: Operator expected
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit