feat: implement Extra credit II

This commit is contained in:
Renge 2024-02-22 00:27:41 -05:00
parent 5433ee3959
commit 26687ea775

10
Extra/2.lp Normal file
View File

@ -0,0 +1,10 @@
#const n = 20.
#const k = 5.
% 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.
:- { q(D+J,J) } >= 2, D = 1-n..n-1.
:- q(X1, Y1), q(X2, Y2), X1 != X2, |(X1 - X2)| + |(Y1 - Y2)| <= k.