-
Notifications
You must be signed in to change notification settings - Fork 0
/
greater-than-sudoku
19 lines (16 loc) · 1.57 KB
/
greater-than-sudoku
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
gt(1,2,1,1).gt(1,3,1,2).gt(1,3,2,3).gt(1,4,1,5).gt(1,6,1,5).gt(1,6,2,6).gt(1,7,2,7).gt(1,8,1,7).gt(1,8,2,8).gt(1,9,1,8).gt(1,9,2,9).
gt(2,1,1,1).gt(2,2,2,1).gt(2,2,2,3).gt(2,2,1,2).gt(2,2,3,2).gt(2,3,3,3).gt(2,4,1,4).gt(2,4,3,4).gt(2,5,1,5).gt(2,5,2,4).gt(2,5,2,6).gt(2,5,3,5).gt(2,6,3,6).gt(2,8,2,7).gt(2,9,2,8).gt(2,9,3,9).
gt(3,1,2,1).gt(3,1,3,2).gt(3,3,3,2).gt(3,4,3,5).gt(3,5,3,6).gt(3,7,2,7).gt(3,7,3,8).gt(3,8,2,8).gt(3,9,3,8).
gt(4,1,4,2).gt(4,1,5,1).gt(4,3,4,2).gt(4,3,5,3).gt(4,5,4,4).gt(4,6,4,5).gt(4,6,5,6).gt(4,7,4,8).gt(4,9,4,8).
gt(5,2,5,1).gt(5,2,5,3).gt(5,2,4,2).gt(5,2,6,2).gt(5,4,4,4).gt(5,4,6,4).gt(5,4,5,5).gt(5,5,4,5).gt(5,5,6,5).gt(5,6,5,5).gt(5,7,4,7).gt(5,7,5,8).gt(5,8,5,9).gt(5,8,4,8).gt(5,9,4,9).
gt(6,1,5,1).gt(6,2,6,1).gt(6,2,6,3).gt(6,3,5,3).gt(6,5,6,4).gt(6,6,6,5).gt(6,6,5,6).gt(6,7,5,7).gt(6,8,6,7).gt(6,8,6,9).gt(6,8,5,8).gt(6,9,5,9).
gt(7,1,7,2).gt(7,1,8,1).gt(7,3,7,2).gt(7,3,8,3).gt(7,4,7,5).gt(7,4,8,4).gt(7,6,8,6).gt(7,6,7,5).gt(7,7,8,7).gt(7,8,7,7).gt(7,8,7,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