sudoku-generator icon indicating copy to clipboard operation
sudoku-generator copied to clipboard

Generate sudoku puzzles of varying difficulties.

What

This is a sudoku generating application. It generates a sudoku puzzle with a unique solution of varying difficulties according to the requested difficulty. It guarantees that there is always a single unique solution for the puzzles it generates.

Why

This was one of my projects for a math modeling class in college.

Status

This is not being actively developed, though there are certainly improvements that could be made.

So what?

Yep, lots of sudoku generators exist. Something cool that makes this one unique is the concept of board density in relation to difficulty. The basic idea is that the more disjoint the set of starting cells is, the more difficult the puzzle will be to solve. This goes beyond the normal measure of "less starting cells is more difficult" and begins to consider what particular configurations of those starting cells makes for the most difficult puzzle.

How do I use it?

python3 sudoku_generator.py base.txt <difficulty>

Difficulties & Sample Results

easy

798 42
78 6 3
14 63 78
564 8 31
8 215 4
6 4 9
3 52 7
4 6879 1
78 13 426

medium

31 6
9 62
4 98 3
398 41
781 5
26 5 9
46798
56 91
8 7 34

hard

2 6
1 48
64 3
6 78 2
16 3 8
89 53
9 42
2 7 5
15 42 7

extreme

7 3 2
4 9
87 3 5
2 5 8
72 1
6 5 94
3 1
46 8
513