Rust Sudoku solver; mostly just a project for me to learn Rust.
Find a file
2022-09-04 22:04:56 -07:00
puzzles Add support for guesses; add other puzzle 2020-09-14 12:58:40 -07:00
src Add support for generating multiple puzzles 2022-09-04 22:04:56 -07:00
.gitignore Update .gitignore 2022-09-04 19:21:44 -07:00
Cargo.lock Update to newer Rust version and newer dependencies 2022-08-17 19:21:29 -07:00
Cargo.toml Update to newer Rust version and newer dependencies 2022-08-17 19:21:29 -07:00
README.md Add support for saving generated puzzles as PDFs 2020-09-23 14:07:15 -07:00

Sudoku Solver

This project started as a way for me to learn Rust. I'd been trying to learn it for a few years, and I've built a Sudoku solver in the past for other languages when I wanted to learn them since it's a small but complex enough task that you get to experience enough of the language; so I thought I'd try the same with Rust.

To build this you'll need to install Cargo. Afterwards, and after you've cloned this project, navigate to the project root and run cargo build --release. Two binaries, solver and generator will be generated in target/release/.

Try running both of them, first with the -h flag to see what other arguments they take.

  • solver reads a CSV file for a puzzle, prints it, solves it, and then prints the solved version. Some example CSV files are in the puzzle folder.
  • generator tries to generate a new puzzle from scratch. You can set a maximum number of hints that it will allow and it will try to generate a puzzle that meets that requirement. You can also optionally write it to a CSV file or a PDF file (determined by file extension).

Regarding code quality, I could probably have commented more and I certainly should have written more unit tests. I also wish that I didn't rely so heavily on Rc & RefCell, which provide ways to get around (sometimes necessarily) the compiler's strict rules on references and ownership. That said, for a project that was really designed for me to learn a language I'm pretty happy with how it turned out.

If you have any questions about my project feel free to email me.