Sudoku Source Code

Download the Script

This page contains source code (in Python) for the examples contained on these pages.

SuSolver

This implements the 5 phases described on the solver page (except the first part of phase 3, looking for numbers that only appear twice and in pairs). This solves all the examples I have tried.

When it can't solve a puzzle using the first 4 phases it enters phase 5 which is intended to enumerate the possible solutions (on the assumption that there are more than one). If there is only 1 solution which isn't found after the first 4 phases then phase 5 will find it. I currently don't have any examples where there is a single unique solution that can't be found using the first 4 phases.

MakeSudoku

This implements the Sudoku creating algorithms described on the "Make your own" page.

SuSolverExamples The test data for SuSolver.

More information about running Python scripts can be found on the Python Patterns page.

Visits since June 2005: