-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
31 lines (27 loc) · 794 Bytes
/
README
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
26
27
28
29
30
31
Write solve_sudoku(Sudoku, SolvedSudoku), print_sudoku(SolvedSudoku).
For example:
?- solve_sudoku(
[ [0, 0, 0, 9, 0, 2, 1, 0, 6]
, [0, 2, 0, 0, 6, 0, 0, 7, 9]
, [0, 0, 9, 0, 0, 0, 0, 0, 0]
, [3, 1, 0, 0, 0, 7, 2, 0, 0]
, [0, 0, 0, 0, 9, 0, 0, 0, 0]
, [0, 0, 6, 5, 0, 0, 0, 3, 8]
, [0, 0, 0, 0, 0, 0, 5, 0, 0]
, [0, 3, 0, 0, 4, 0, 0, 8, 0]
, [6, 0, 1, 2, 0, 3, 0, 0, 0]
],
Sud), print_sudoku(Sud).
This should come out:
[ [8, 4, 7, 9, 3, 2, 1, 5, 6]
, [1, 2, 3, 4, 6, 5, 8, 7, 9]
, [5, 6, 9, 7, 1, 8, 3, 2, 4]
, [3, 1, 4, 6, 8, 7, 2, 9, 5]
, [2, 5, 8, 3, 9, 4, 7, 6, 1]
, [9, 7, 6, 5, 2, 1, 4, 3, 8]
, [4, 9, 2, 8, 7, 6, 5, 1, 3]
, [7, 3, 5, 1, 4, 9, 6, 8, 2]
, [6, 8, 1, 2, 5, 3, 9, 4, 7]
]
If there is more than one possible solution, then after
hitting ; the solver will find them too.