Sudoku Solver Details
The program was designed to solve any Sudoku puzzle in the following high-level steps.
- Accepts a sudoku image as input
- Identifies the board space by mapping the image to black and white, creating a numpy array, and exploring the array recording the total area of the board
- Crops the original image to only show the straightened and rotated board image based on the previously determined board area
- Identifies all squares where numbers are present and not present and stores the data in an array
- All squares with numbers present are compared against the training data and number with best match score is selected
- Sends the unsolved array to the sudoku solver algorithm that incorporates a backtracking solving method for more complex puzzles and returns the solved board array
- Uses the solved array to place the solution numbers in their respective positions on the uploaded board
- A board complete with the solved numbers in red print presented to the user
Test Samples
Below are a number of test puzzles and generated solutions used to test the ability of the solver.
Test Case 1: Easy Puzzle
Test Case 2: Medium Puzzle
Test Case 3: Difficult Puzzle Left Rotation
Test Case 4: Difficult Puzzle Right Rotation
Test Case 5: World's Hardest Sudoku