2024-02-22 17:33:26 -05:00
|
|
|
#const n = 500.
|
2024-02-21 23:53:58 -05:00
|
|
|
|
|
|
|
% n-Queens encoding
|
|
|
|
|
|
|
|
{ q(I,1..n) } == 1 :- I = 1..n.
|
|
|
|
{ q(1..n,J) } == 1 :- J = 1..n.
|
|
|
|
:- { q(D-J,J) } >= 2, D = 2..2*n.
|
2024-02-22 14:04:07 -05:00
|
|
|
:- { q(D+J,J) } >= 2, D = 1-n..n-1.
|