This is a simple Java implementation of a Sudoku solver using a backtracking algorithm. Given a partially filled Sudoku grid, the program attempts to fill in all the empty cells such that every row, column, and 3x3 subgrid contains all the digits from 1 to 9 without repetition.
Usage Algorithm Contributing License
To use this Sudoku solver, follow these steps:
- Clone this repository to your local machine.
- Compile the sudoku.java file using any Java compiler.
- Run the compiled file using the command java sudoku.
- Ensure you have Java installed on your system to run the solver.
The Sudoku solver implemented in this codebase uses a recursive backtracking algorithm. Here's a brief overview of the algorithm:
- Start from the top-left corner of the Sudoku grid.
- If the current cell is empty, try filling it with a digit from 1 to 9.
- Check if the digit placement is valid according to Sudoku rules (no repetition in rows, columns, and 3x3 subgrids).
- If the digit placement is valid, move to the next cell and repeat steps 2-3 recursively.
- If a solution is found, the algorithm stops.
- If no valid digit can be placed, backtrack to the previous cell and try a different digit.
- Repeat the process until a solution is found or all possibilities are exhausted.
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.