Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Latest commit

 

History

History
49 lines (33 loc) · 1.19 KB

README.md

File metadata and controls

49 lines (33 loc) · 1.19 KB

Sudoku Bot

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.

How it works

The main logic is written in bot.py. The general steps are:

  1. Switch to browser and start new puzzle
  2. Take a screenshot
  3. Use OpenCV to find the bounds of the puzzle within the screenshot
  4. Use Tesseract OCR on each cell of the puzzle and store into a list
  5. Use Knuth's Algorithm X with Dancing Links to solve the puzzle (implemented in Rust)
  6. Click on each empty cell and enter the number found in the solution

Building

This project is built using Maturin. Make sure to have Rust, Maturin and Python installed. Steps to build:

  1. Create a new Python venv:

    python3 -m venv .venv
    source .env/bin/activate
  2. Build the Rust library:

    maturin build
  3. Install the Python wheel:

    maturin develop
  4. Install dependencies:

pip install pyautogui numpy pytesseract opencv-python
  1. Run the bot:

    python3 bot.py