Skip to content

🧩 A Flask-based web app that can recognize Sudoku puzzles from images, generate new puzzles, and solve any grid using OCR and OpenCV. Designed for puzzle enthusiasts and developers exploring computer vision + algorithms.

License

Notifications You must be signed in to change notification settings

aman75verma/Sudoku-Solver-And-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Sudoku Solver Web App

A web-based application to recognize, generate, and solve Sudoku puzzles using image processing (OCR), Backtracking algorithms, and Flask for the backend API. Users can upload an image of a Sudoku puzzle, generate new puzzles of varying difficulty, or solve manually entered ones.


πŸš€ Features

  • βœ… Upload a Sudoku image and auto-recognize the grid using OpenCV and Tesseract OCR
  • βœ… Generate valid Sudoku puzzles (easy, medium, hard)
  • βœ… Solve any valid Sudoku grid using a backtracking algorithm
  • βœ… Clean and modular backend using Flask

πŸ› οΈ Tech Stack

  • Backend: Python, Flask
  • Image Processing: OpenCV, Pytesseract, PIL (Pillow)
  • Sudoku Logic: Numpy-based grid manipulation, AI solver & generator
  • Frontend: HTML/CSS/JavaScript

πŸ“ Project Structure

β”œβ”€β”€ app.py                 # Flask main application
β”œβ”€β”€ recognizer.py          # Handles OCR and Sudoku grid recognition from images
β”œβ”€β”€ solver.py              # Sudoku solver using backtracking
β”œβ”€β”€ generator.py           # Sudoku puzzle generator with difficulty levels
β”œβ”€β”€ templates/             # HTML templates (e.g., index.html)
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ styles/            # CSS files
β”‚   └── scripts/           # JavaScript files
β”œβ”€β”€ uploads/               # Temporary upload folder (auto-created)
β”œβ”€β”€ requirements.txt       # Python dependencies
└── README.md              # You're here

🧩 Setup Instructions

1. πŸ”§ Install System Dependencies

Ensure you have Python 3.7+ installed.

You also need Tesseract-OCR installed on your system:

Windows:

# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

Linux (Ubuntu):

sudo apt update
sudo apt install tesseract-ocr

2. 🐍 Create Virtual Environment (Recommended)

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. πŸ“¦ Install Python Dependencies

pip install -r requirements.txt

4. ▢️ Run the App

python app.py

Then visit: http://127.0.0.1:5000


βœ… Dependencies (requirements.txt)

Flask
numpy
opencv-python
pytesseract
Pillow

πŸ’‘ Future Improvements

  • Add support for mobile camera capture
  • Improve OCR digit recognition with CNN
  • Track solving steps visually

πŸ“„ License

This project is open-source and available under the MIT License.


Made with 🧠, 🐍, and ❀️ for Sudoku enthusiasts!

About

🧩 A Flask-based web app that can recognize Sudoku puzzles from images, generate new puzzles, and solve any grid using OCR and OpenCV. Designed for puzzle enthusiasts and developers exploring computer vision + algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published