-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.java
More file actions
37 lines (33 loc) · 1.17 KB
/
Copy pathMain.java
File metadata and controls
37 lines (33 loc) · 1.17 KB
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
32
33
34
35
36
37
import backtracking.SudokuSolver;
import java.util.Arrays;
/**
* Runs the algorithm examples.
*/
public class Main {
public static void main(String[] args) {
int[][] board0 = {
{-1, 1, 2, -1, -1, 6, 5, 8, 9},
{6, 7, -1, -1, -1, -1, -1, -1, 2},
{-1, 8, 4, 1, -1, 5, 6, 3, -1},
{4, 3, 8, 2, 5, 9, 1, -1, -1},
{-1, -1, -1, -1, -1, -1, -1, -1, -1},
{-1, -1, 7, 8, 1, 4, 3, 9, 5},
{-1, 9, 6, 5, -1, 1, 7, 2, -1},
{7, -1, -1, -1, -1, -1, -1, 5, 1},
{5, 4, 1, 7, -1, -1, 8, 6, -1}
};
int[][] board1 = {
{5, 3, -1, -1, 7, -1, -1, -1, -1},
{6, -1, -1, 1, 9, 5, -1, -1, -1},
{-1, 9, 8, -1, -1, -1, -1, 6, -1},
{8, -1, -1, -1, 6, -1, -1, -1, 3},
{4, -1, -1, 8, -1, 3, -1, -1, 1},
{7, -1, -1, -1, 2, -1, -1, -1, 6},
{-1, 6, -1, -1, -1, -1, 2, 8, -1},
{-1, -1, -1, 4, 1, 9, -1, -1, 5},
{-1, -1, -1, -1, 8, -1, -1, 7, 9}
};
SudokuSolver.solveSudoku(board0);
for (int[] r : board0) { System.out.println(Arrays.toString(r)); }
}
}