A program that uses the backtracking algorithm and the Python Selenium Library to solve an expert sudoku board live on sudoku.com.
- Install all packages in your project directory
$ pip install -r requirements.txt
-
Make sure that you are using the appropriate web driver for your browser. The default implementation is for Chrome.
-
Run selen.py using
$ py selen.py
- Modify solving paramaters in selen.py
This program uses the backtracking algorithm to solve the Sudoku puzzle.
- Locate the empty spaces in the project. To start we will be using the number 0 to place them as Sudoku only uses numbers between 1-9.
- Attempt to place numbers 1-9 in the place of the 0.
- Check if the digit is valid in the current spot based on the current board.
- If valid, recursivly attempt to fill the board.
- If invalid, reset the entry just filled and try again.
- Once the board is full, the puzzle is solved.
The program then uses the Selenium Python library to open an instance of chrome with the url : Sudoku.com/expert/. It then copies the board, solves it, then inputs it back into the site using the given numpad.
Credits to TechWithTim for parts of his Sudoku Solver
This project is under the MIT Licence for Open Source.