https://github.com/lukashedegaard/sudoku-solver-rust
https://github.com/lukashedegaard/sudoku-solver-rust
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lukashedegaard/sudoku-solver-rust
- Owner: LukasHedegaard
- License: apache-2.0
- Created: 2021-07-12T19:15:50.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-13T14:25:38.000Z (almost 4 years ago)
- Last Synced: 2025-01-06T16:14:48.074Z (4 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sudoku solver in Rust
This repo contains a Sudoku solver which uses recursion and [backtracking](https://en.wikipedia.org/wiki/Backtracking) in its implementation.
## Usage
1. [Install Rust](https://www.rust-lang.org/tools/install).
1. Modify sudoku in `src/main.rs`
1. Run example with `cargo run`.```bash
Initial:
['9', '.', '6', '5', '7', '.', '4', '2', '.']
['5', '.', '2', '1', '4', '.', '8', '.', '.']
['.', '.', '4', '.', '.', '.', '.', '.', '5']
['.', '.', '5', '.', '.', '.', '6', '.', '3']
['8', '.', '3', '.', '.', '.', '2', '.', '4']
['4', '.', '7', '.', '.', '.', '.', '.', '.']
['2', '.', '.', '.', '.', '.', '5', '.', '.']
['.', '.', '8', '.', '1', '6', '.', '.', '2']
['.', '4', '.', '.', '2', '5', '.', '.', '9']Solution:
['9', '8', '6', '5', '7', '3', '4', '2', '1']
['5', '3', '2', '1', '4', '9', '8', '6', '7']
['7', '1', '4', '2', '6', '8', '9', '3', '5']
['1', '2', '5', '4', '8', '7', '6', '9', '3']
['8', '9', '3', '6', '5', '1', '2', '7', '4']
['4', '6', '7', '3', '9', '2', '1', '5', '8']
['2', '7', '9', '8', '3', '4', '5', '1', '6']
['3', '5', '8', '9', '1', '6', '7', '4', '2']
['6', '4', '1', '7', '2', '5', '3', '8', '9']
```## Performance
The programme solves a "hard" sudoku in approx. 0.3 seconds.