This project is a web-based Sudoku solver built using the backtracking algorithm. It allows users to input a partially filled Sudoku grid and computes the correct solution efficiently.
Sudoku is a 9×9 grid-based puzzle where each row, column, and 3×3 subgrid must contain numbers from 1 to 9 without repetition. This project demonstrates how a classic recursive algorithm can be used to solve such constraint-based problems.
- Solves any valid Sudoku puzzle
- Uses an efficient backtracking approach
- Handles partially filled grids
- Simple and responsive user interface
- Runs directly in the browser without any dependencies
- HTML
- CSS
- JavaScript
The solver is based on the backtracking technique:
-
Identify an empty cell in the grid
-
Try placing numbers from 1 to 9
-
Check whether the number is valid:
- Not present in the same row
- Not present in the same column
- Not present in the corresponding 3×3 subgrid
-
If valid, proceed to the next empty cell
-
If no valid number is found, backtrack and try a different number
This approach ensures that all possibilities are explored until a valid solution is reached.
sudoku-solver-backtracking/ │ ├── index.html Main user interface ├── style.css Styling for the application ├── script.js Backtracking logic and interactions └── README.md Project documentation
- Open the deployed application in your browser
- Enter the known values of the Sudoku puzzle
- Click on the "Solve" button
- The completed solution will be displayed instantly
Input: 5 3 0 | 0 7 0 | 0 0 0 6 0 0 | 1 9 5 | 0 0 0
Output: 5 3 4 | 6 7 8 | 9 1 2 6 7 2 | 1 9 5 | 3 4 8
- Difficulty level selection
- Hint functionality
- Performance optimization for large variations
- Improved UI/UX
Charu Awasthi GitHub: https://github.com/Charu19awasthi 🔗 Live Demo: https://charu19awasthi.github.io/sudoku-solver-backtracking/
This project is open source and available under the MIT License.