Sudoku-Solver
Solves any game of Sudoku from Sudoku.com
Table Of Contents:
How It Works
- Creates an image of each tile on the Sudoku board using PyAutoGUI
- Uses OpenCV to create an Image threshold to use in the character recognition step.
- Using character recognition, determine the number in each image. To recognise digits and store them in a NumPy array, PyTesseract is used.
- Solves the Sudoku Puzzle using a recursive backtracking algorithm.
- Tracks the user's mouse and determines which tile has been clicked.
- Using Pyttsx3 the program will yell out the answer of the current tile such that the user can input the answer into the board.
Installation
-
Download and install Python3 from here
-
Download and install Google's Tesseract from here
-
I recommend using virtualenv. Download virtualenv by opening a terminal and typing:
pip install virtualenv
-
Create a virtual environment with the name sudokuenv.
- Windows
virtualenv sudoku cd sudoku/Scripts activate
- Linux:
source sudoku/bin/activate
-
Clone this repository, extract it if you downloaded a .zip or .tar file and cd into the cloned repository.
- For Example:
cd C:\Sudoku-Solver-master
-
Install the required packages by typing:
pip install -r requirements.txt
Usage
Setup For Use
- First things first open up Sudoku.com.
- Once you run the program there is a 3 second interval where you can make your way to the webpage.
- Be sure to scroll all the way to the top of the page so that the images can be taken of the tiles correctly.
- Make sure the volume is turned up so you can hear the program's current stage. When the sound "Let's play some sudoku" plays, you can press on any tile on the board to hear what value should be put there.
Running The Program
To run the program:
python3 solver.py