Sudoku solver for 9x9 16x16 size.
Usage: main.py <input_file> <output_file>
Based on: https://techwithtim.net/tutorials/python-programming/sudoku-solver-backtracking/
Current speedup compared to original code (depending on size, and hardness of sudoku): ~50-67000x
Optimizations compared to original code from above:
- Changed most for loops to list slicing & comprehension.
- Changed for cycles to "in" for membership tests.
- Moved size/box_size/etc constant calculations outside of for loops.
- Added mask with possible valid values
- Added board preprocessing based on valid values mask
New features:
- Added ability to import csv
- Added ability to solve both 9x9 & 16x16 sudoku puzzles
- Added basic runtime timing for performance evaluation
- Added logging for better performance evaluation
- Added capability to save solutions to disk
- Added concurrent batch processing capability
Todo:
- Optimize further for speed? OR Write efficient parallel python code based on this paper: https://shawnjzlee.me/dl/efficient-parallel-sudoku.pdf
- Test PyPy speedup?
- Generalize for all possible sudoku sizes.
- OCR
- Multiplatform GUI with Kivy