Do you want to remove sudoko from your life? Look no further.
This package has evolved over 1-day to include a Flask App for more detailed visual feedback. To run the app, first get set-up with the dependencies (see below), then run
python -m gsolver.app.main
and browse to
127.0.0.1:5000
. The puzzle located at gsolver/sudoku_puzzle.txt
will be populated on loading the
window. Hit the "Solve" button to see either the full solution or the partial solution
if "unsolveable" with the current game-solver.
Apart from the most simple puzzles, sudoku cannot be solved by just eliminating possible cell values based on values that already exist in intersecting rows, columns, and blocks.
For example, consider this partial solution, paying particular attention to row 5 (1-indexed):
. We see that there are multiple cells where the number "4" might be placed in row 5, but if we instead consider which rows, columns, or blocks require a "4", then we see that the right most center block only has one option where a "4" can be placed, leading us to this solution:
.
So far, after a weekend of testing (and one particularly difficult newspaper soduko puzzle), the puzzle has been solved using this alternating strategy:
- Remove intersecting values from the solution space
- Accept solutions that only appear once in the solution space for a row, column, or block
Originally the problem was formulated in such a way that we might get to do some linear algebra, but no real luck there. There is always the hope for a vectorization refactor.
To get started
- Create a virtual environment
python3 -m venv gslvr
- Activate the virtual environment
source gslvr/bin/activate
- Install all the required packages in the virtual environment
pip install -r requirements.txt
When finished working with game-solver, you can deactivate the venv with
deactivate