This java code produces a GUI, onto which you can input the the sudoku question. By clicking on the Sudoku it Button the empty spaces are filled. There are 3 wayas of adding input to this Sudoku.
- Directly add the question in the GUI(matrix)
0 0 9 0 6 5 4 3 0
0 0 7 0 0 0 8 0 0
6 0 0 1 0 8 0 2 0
0 0 3 0 9 0 0 0 2
5 0 1 4 0 3 9 6 0
8 0 4 0 0 0 1 0 0
0 3 0 5 0 9 0 0 7
0 5 6 0 8 0 0 0 0
0 7 0 2 4 0 0 9 0
--> Using . instead of the blank cells
1 2 . 4 . . 3 . .
3 . . . 1 . . 5 .
. . 6 . . . 1 . .
7 . . . 9 . . . .
. 4 . 6 . 3 . . .
. . 3 . . 2 . . .
5 . . . 8 . 7 . .
. . 7 . . . . . 5
. . . . . . . 9 8
only these two format of input would display the results.
- We can also add the input by choosing the location of the csv(excel file) of the sudoku.
Both the matrix and the text tabs in the gui are filled with the solution of the given question.
Ex:the following has been input in the text tab.
After clicking on sudoku it. Solution appears in both tabs.
Note: The spacing between the numbers in text tab is very important for the sudoku to work.
For entering a new sudoku, use clear input button.
This code works well for all levels of sudoku.
You might have to wait for a couple of seconds incase of a very difficult sudoku puzzle.
Also, if a wrong input is given to teh sudoku then, error appears.
Ex: Here the last row consists of only 8 values (there have to be 9)
The error box appears.