A Sudoku solver implemented with Rust.
- Overview
- Features
- Motivation
- Installation
- Usage
- Examples
- Testing
- Roadmap
- Contributing
- Acknowledgements
- License
This repository provides a command-line Sudoku solver algorithm written in Rust.
It takes a partially filled Sudoku board and attempts to solve it, yielding a completed board if the puzzle is valid and solvable.
- Pure Rust implementation
- Efficient backtracking / search-based solver
- Clean and minimal dependencies
- Unit-tested logic
- Simple CLI for running puzzles
The project was built to:
- Explore algorithmic problem solving in Rust
- Practice ownership, borrowing, and efficient data structures
- Provide a simple tool for solving Sudoku puzzles
Make sure you have Rust installed (via rustup).
Clone the repo:
git clone https://github.com/jplotkin05/sudoku-solver.git
cd sudoku-solverBuild the project in release mode for best performance:
cargo build --releaseRun the solver with a Sudoku input file:
cargo run -- puzzles/example.txt- Input must be a text file with the Sudoku grid written row by row.
- Use
.or0to represent blank cells. - The solver will print the solved board (or report if unsolvable).
5 3 . . 7 . . . .
6 . . 1 9 5 . . .
. 9 8 . . . . 6 .
8 . . . 6 . . . 3
4 . . 8 . 3 . . 1
7 . . . 2 . . . 6
. 6 . . . . 2 8 .
. . . 4 1 9 . . 5
. . . . 8 . . 7 9
cargo run -- puzzles/example.txt5 3 4 6 7 8 9 1 2
6 7 2 1 9 5 3 4 8
1 9 8 3 4 2 5 6 7
8 5 9 7 6 1 4 2 3
4 2 6 8 5 3 7 9 1
7 1 3 9 2 4 8 5 6
9 6 1 5 3 7 2 8 4
2 8 7 4 1 9 6 3 5
3 4 5 2 8 6 1 7 9
Run the unit tests:
cargo test- Add difficulty classification (easy, medium, hard)
- Benchmark performance on large sets of puzzles
- Support for multiple solution strategies
- Option to generate Sudoku puzzles
Contributions are welcome!
- Fork the repo
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/my-feature) - Open a pull request
- Rust for making systems programming fun and safe
- Classic Sudoku puzzle inspiration
This project is licensed under the MIT License.
See the LICENSE file for details.