Skip to content

Predictor/sudoku-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoku solver

Prerequisites

  • JDK 12 (lower versions might work)
  • IntelliJ IDEA (to build and run tests, as there is no build script provided)

Input file format

Plain text file containing 9 rows of 9 numbers (0-9). Each number represents a cell. 0 indicates an empty cell. The file can contain tabs or spaces or line breaks for readability. All those separators will be ignored.

Command line arguments

The only required and allowed argument is absolute or relative path to an input file. See SudokuSolverArgs.java.

Main classes

  • SudokuSolverApp – contains main method of the application
  • SudokuSolverArgs – command line arguments parser (check for input format)
  • SudokuBoard – represents a Sudoku puzzle, allows getting a cell value, or setting a cell value, also provides mechanics to validate cell input values according to Sudoku rules.
  • SudokuBacktrackingSolver – implements decision making conditions for backtracking search of the puzzle solution.

Tests and test cases

Unit tests for SudokuBacktrackingSolver are located in SudokuSolverTests class.
Test cases can be found in sudoku-solver/test/resources folder.
Required examples are marked as sample2 and sample3.
Sample4 contains a Sudoku designed against brute force algorithms, such as backtracking. It takes approximately 1 minute to complete on AMD-FX-8320.
Sample files with “-bad” suffix contain unsolvable Sudoku examples.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages