54 lines
1.2 KiB
Markdown
54 lines
1.2 KiB
Markdown
# Sudoku Solver
|
|
|
|
Figured it would be fun to try making a sudoku solver. I haven't read
|
|
any prior art as of yet, though I might at some point to improve
|
|
this. I found [this
|
|
dataset](https://www.kaggle.com/datasets/rohanrao/sudoku) to use for
|
|
testing and benchmarking; it contains 9 million puzzles. I haven't
|
|
included the dataset in this repository as it's quite big (around 1.4
|
|
GiB), but you can download the archive from the above link and place
|
|
the extracted `sudoku.csv` in the root of this repo and it should
|
|
work.
|
|
|
|
## Building
|
|
|
|
The program is built with `make(1)`:
|
|
|
|
```shell
|
|
make # or 'make sudoku'
|
|
```
|
|
|
|
## Preparation of Puzzles File
|
|
|
|
I did some pre-processing of the downloaded `sudoku.csv` file to
|
|
reduce the workload of the solver, extracting just the puzzles (the
|
|
CSV contains the solutions too) and removing the newlines.
|
|
|
|
```shell
|
|
make puzzles
|
|
```
|
|
|
|
## Preparation of Results File
|
|
|
|
The results file must exist and be of the right size in order for the
|
|
program to run successfully.
|
|
|
|
```shell
|
|
make results
|
|
```
|
|
|
|
## Running
|
|
|
|
The program can be ran through the Makefile, which will ensure the
|
|
binary is built and the puzzles and results files have been prepared:
|
|
|
|
```shell
|
|
make run
|
|
```
|
|
|
|
Or it can of course be ran directly:
|
|
|
|
```shell
|
|
./sudoku
|
|
```
|