This is a Sudoku Solver built using Angular with standalone components and utilizes backtracking algorithm. The application allows you to:
- Randomly fill some cells in the Sudoku board.
- Manually solve the Sudoku.
- Solve the Sudoku using a backtracking algorithm with visualization.
You can access the hosted application here.
- Randomly Fill: Fill the Sudoku board with random numbers in valid positions.
- Solve: Automatically solve the Sudoku using backtracking with visualization.
- Manual Solve: Manually solve the Sudoku by entering numbers in the cells.
To run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/sudoku-solver.git cd sudoku-solver
-
Install the dependencies:
npm install
-
Run the application:
ng serve
-
Open your browser and navigate to
http://localhost:4200
.
- Randomly Fill: Click the "Randomly Fill" button to fill some cells with random numbers.
- Solve: Click the "Solve" button to start the backtracking algorithm. The process will be visualized in the grid.
- Manual Solve: After clicking "Randomly Fill," you can enter numbers manually in the cells to solve the Sudoku.
- SudokuSolverComponent: This is the main component responsible for rendering the Sudoku grid, handling user interactions, and solving the Sudoku.
fillRandom()
: Randomly fills some cells in the Sudoku board with valid numbers.solveSudoku()
: Initiates the backtracking algorithm to solve the Sudoku.solve(row: number, col: number)
: The recursive function implementing the backtracking algorithm.isSafe(row: number, col: number, num: number)
: Checks if placing a number in a specific cell is valid.updateBoard()
: Adds a delay to visualize the backtracking process.
- The project uses MDUI components..
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you have any questions or feedback, feel free to reach out.