-
Notifications
You must be signed in to change notification settings - Fork 0
/
sudoku-v2
25 lines (22 loc) · 1.32 KB
/
sudoku-v2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
a(1,1,1).a(1,4,2).a(1,5,3).a(1,6,4).a(1,9,12).a(1,11,6).a(1,15,7).
a(2,3,8).a(2,7,7).a(2,10,3).a(2,13,9).a(2,14,10).a(2,15,6).a(2,16,11).
a(3,2,12).a(3,5,10).a(3,8,1).a(3,10,13).a(3,12,11).a(3,15,14).
a(4,1,3).a(4,4,15).a(4,5,2).a(4,8,14).a(4,12,9).a(4,15,12).
a(5,1,13).a(5,5,8).a(5,8,10).a(5,10,12).a(5,11,2).a(5,13,1).a(5,14,15).
a(6,2,11).a(6,3,7).a(6,4,6).a(6,8,16).a(6,12,15).a(6,15,5).a(6,16,13).
a(7,4,10).a(7,6,5).a(7,7,15).a(7,10,4).a(7,12,8).a(7,15,11).
a(8,1,16).a(8,4,5).a(8,5,9).a(8,6,12).a(8,9,1).a(8,15,8).
a(9,2,2).a(9,8,13).a(9,11,12).a(9,12,5).a(9,13,8).a(9,16,3).
a(10,2,13).a(10,5,15).a(10,7,3).a(10,10,14).a(10,11,8).a(10,13,16).
a(11,1,5).a(11,2,8).a(11,5,1).a(11,9,2).a(11,13,13).a(11,14,9).a(11,15,15).
a(12,3,12).a(12,4,4).a(12,6,6).a(12,7,16).a(12,9,13).a(12,12,7).a(12,16,5).
a(13,2,3).a(13,5,12).a(13,9,6).a(13,12,4).a(13,13,11).a(13,16,16).
a(14,2,7).a(14,5,16).a(14,7,5).a(14,9,14).a(14,12,1).a(14,15,2).
a(15,1,11).a(15,2,1).a(15,3,15).a(15,4,9).a(15,7,13).a(15,10,2).a(15,14,14).
a(16,2,14).a(16,6,11).a(16,8,2).a(16,11,13).a(16,12,3).a(16,13,5).a(16,16,12).
1{a(X,Y,N):X=1..16,Y=1..16,X1<=X,X<=X1+3,Y1<=Y,Y<=Y1+3}1 :- N=1..16,X1=4*(0..3)+1,Y1=4*(0..3)+1.
:-a(X,Y,N),a(X,Y,N1),N!=N1.
:-a(X,Y,N),a(X,Y1,N),Y!=Y1.
:-a(X,Y,N),a(X1,Y,N),X!=X1.
#show a/3.
%clingo D:\Sem1\CSE-579\Assignment3\4.txt 0