Solve my statistics problem

Please forward this error screen to sharedip-10718044142. Solving Every Sudoku Puzzle by Peter Norvig In this solve my statistics problem I tackle the problem of solving every Sudoku puzzle.

Cross product of elements in A and elements in B. One might think that a 9 x 9 array would be the obvious data structure. Therefore, values will be a dict with squares as keys. The value of each key will be the possible digits for that square: a single digit if it was given as part of the puzzle definition or if we have figured out what it must be, and a collection of several digits if we are still uncertain. If a unit has only one possible place for a value, then put the value there. Unfortunately, that will not always be the case.

We could try to code more sophisticated strategies. For example, the naked twins strategy looks for two squares in the same unit that both have the same two possible digits. I guess if I want a really hard puzzle I’ll have to make it myself. I don’t know how to make hard puzzles, so I generated a million random puzzles.

My algorithm for making a random puzzle is simple: first, randomly shuffle the order of the squares. One by one, fill in each square with a random digit, respecting the possible digit choices. If a contradiction is reached, start over. Unfortunately, this is not a true Sudoku puzzle because it has multiple solutions.