





Algorithms and code languages are tested on a various of parameters:
- Speed (average time to solve a sudoku)
- Accuracy (average number of tries to solve an empty cell)
- Solving ability (% of sudoku's solved)
The average time to solve a sudoku with each of the algorithms were as followed:
The algorithms are tested by solving 100 random sudokus each iteration and the times for python were as followed:
Exact times both in Python and C:
Algorithm | Python | C |
---|---|---|
Bruteforce | - | - |
Backtracking | 14.9 ms | 0.033 ms |
Backtracking (easiest first) | 6.6 ms | |
Candidate-checking | 23.3 ms | 0.054 ms |
Place-finding | 82.3 ms | 0.071 ms |
Crook's Algorithm | 4.3 ms | 0.149 ms |
Bruteforce is considerable slower than the other algorithms, and can't be tested in a reasonable time.
Average number of tries per empty cell:
Algorithm | Avg. tries |
---|---|
Bruteforce | 8.9 |
Backtracking | 2.9 |
Backtracking (easiest first) | 1.9 |
Candidate-checking | 1.0 |
Place-finding | 1.0 |
Crook's Algorithm | 1.0 |
Percentage of sudokus solved:
Algorithm | Sudokus solved |
---|---|
Bruteforce | 100.00% |
Backtracking | 100.00% |
Backtracking (easiest first) | 100.00% |
Candidate-checking | 99.96% |
Place-finding | 58.85% |
Crook's Algorithm | 100.00% |
This is equivalent to candidate checking not being able to solve 337 out of the 1.000.000 sudokus in the Kaggle-dataset.
Algorithms are tested on 1 million Sudoku games accessible on Kaggle (https://www.kaggle.com/datasets/bryanpark/sudoku)