The Sudoku Solver is a C program that uses a backtracking algorithm to solve 9x9 Sudoku puzzles. The solver reads an initial board configuration from a file, solves the puzzle, and prints both the initial and solved states of the board.
- Backtracking Algorithm: Efficiently solves 9x9 Sudoku puzzles.
- Input Handling: Reads Sudoku puzzles from text files.
- Board Validation: Ensures that the board adheres to Sudoku rules during the solving process.
- Test Suite: Includes a test suite to validate the solver against various Sudoku puzzles.
- Command-Line Interface: Simple and easy-to-use CLI for running the solver.
- GCC (GNU Compiler Collection)
- Make
- Bash
To build the project, clone the repository and run the following command:
make
This will compile the sudoku
executable.
To solve a Sudoku puzzle, run the sudoku
program with the path to a text file containing the puzzle:
./sudoku <FILENAME>
Each Sudoku puzzle should be represented as a 9x9 grid in a text file, with empty cells represented by spaces or any other non-numeric character that you choose to use.
Tip
Check out ASCIIFlow to build text Sudoku boards fast and easy.
Example:
74 1 5
3 9
596 4
42
1 5
81 7 39
6
3 8
To run the test suite, which compiles and executes the tests against various puzzles, use:
chmod +x tests/test_sudoku.sh
./tests/test_sudoku.sh
This script will compile the test suite, run the tests on the puzzles, and display the results.
To clean up compiled files and binaries, run:
make clean
This project is licensed under the MIT License - see the LICENSE file for details.