This was a project created by Nathan Rowan to experiment with OpenCV, pyautogui
and implementing Knuth's Algorithm X in Rust. The bot is able to complete Sudoku.com puzzles on "evil" difficulty in 15 seconds.
The main logic is written in bot.py. The general steps are:
- Switch to browser and start new puzzle
- Take a screenshot
- Use OpenCV to find the bounds of the puzzle within the screenshot
- Use Tesseract OCR on each cell of the puzzle and store into a list
- Use Knuth's Algorithm X with Dancing Links to solve the puzzle (implemented in Rust)
- Click on each empty cell and enter the number found in the solution
This project is built using Maturin. Make sure to have Rust, Maturin and Python installed. Steps to build:
-
Create a new Python venv:
python3 -m venv .venv source .env/bin/activate
-
Build the Rust library:
maturin build
-
Install the Python wheel:
maturin develop
-
Install dependencies:
pip install pyautogui numpy pytesseract opencv-python
-
Run the bot:
python3 bot.py