Skip to content

This java code produces a GUI, onto which you can input the the sudoku question and the code solves it.

Notifications You must be signed in to change notification settings

mounika2000/Sudoku-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Sudoku-Solver

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.

  1. Directly add the question in the GUI(matrix)

grid

2. By typing out the contents of the sudoku in the text tab

text

the input here can be in two form: --> Using 0 instead of the blank cells

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.

  1. We can also add the input by choosing the location of the csv(excel file) of the sudoku.

csv

After inputting the sudoku into the frame, click on sudoku it button.

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.
1

After clicking on sudoku it. Solution appears in both tabs.
2 3

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.

notValid

About

This java code produces a GUI, onto which you can input the the sudoku question and the code solves it.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages