An interactive, fully responsive web application that generates, solves, and visualizes Sudoku puzzles. This project bridges the gap between Competitive Programming (CP) logic and Frontend Development, demonstrating how complex algorithms like Backtracking can be applied in a practical user interface.
🚀 Live Demo: sudokusolverbysk.vercel.app
- Sudoku Generation: Creates unique, solvable puzzles with three distinct difficulty levels:
- Easy: 30 cells removed.
- Medium: 40 cells removed.
- Hard: 50 cells removed.
- Custom Input: Clear the board and enter your own puzzles to solve them instantly.
- Intelligent Hint System: Uses the solver algorithm to find the correct value for the most constrained empty cell.
- Step-by-Step Visualization: Watch the backtracking algorithm "think" in real-time with customizable delays and color-coded cell states (Trying vs. Backtracking).
- MRV Heuristic: Optimized search space using the Minimum Remaining Values technique.
- Game Persistence: Save your current progress and hint count to
localStorageand resume later. - Performance Metrics: Built-in timer and score tracker to gamify the experience.
- Fully Responsive: Optimized UI for both Desktop and Mobile devices.
The core engine uses a Depth-First Search (DFS) based backtracking algorithm. To optimize the search space, it employs the Minimum Remaining Values (MRV) heuristic:
- Find the Most Constrained Cell: Instead of picking the first empty cell, the algorithm finds the cell with the fewest valid candidates.
- Pruning: If a cell has zero candidates, the algorithm "fails fast" and backtracks immediately.
- Randomization: During generation, candidate numbers (1–9) are shuffled to ensure a unique board every time.
| Function | Complexity | Description |
|---|---|---|
| Solver | O(9^M) |
M = number of empty cells |
| Heuristic (MRV) | O(N^4) |
Can be optimized to O(N^3) |
| Validation | O(N^3) |
Can be optimized to O(N^2) |
- Structure: HTML5
- Styling: Tailwind CSS & Custom CSS3
- Language: JavaScript (ES6+)
- Storage: LocalStorage API
├── index.html # Structure & UI Components
├── index.css # Custom animations & Media Queries
└── function.js # Solver logic, Heuristics & DOM Manipulation
- Clone the repository:
git clone [https://github.com/yourusername/sudoku-solver.git](https://github.com/yourusername/sudoku-solver.git)
- Open the project:
Simply open
index.htmlin any modern web browser. No build steps, installations, or dependencies required.
This project is completely open-source and I welcome contributions! If you want to improve the algorithm, or to improve the UI, or fix a bug, or any new feature, feel free to jump in.
- Fork the repository.
- Clone your fork:
git clone https://github.com/yourusername/sudoku-solver.git - Create a branch:
git checkout -b feature/your-feature-name - Commit your changes:
git commit -m "Add some feature" - Push to the branch:
git push origin feature/your-feature-name - Open a Pull Request!
This project is licensed under the MIT License. You are free to use, modify, and distribute this software as you see fit. See the LICENSE file for more details.
Saurabh Kumar
- LinkedIn: Saurabh Kumar
This project was developed as part of a 6-week summer training in Competitive Programming, focusing on bridging the gap between algorithmic theory and practical software implementation.