jeffsieu / py-sudoku

A Python Sudoku solver
https://pypi.org/project/py-sudoku
MIT License
81 stars 23 forks source link

Check for multiple solutions #12

Closed alexisflesch closed 2 months ago

alexisflesch commented 4 months ago

Added an extra optional argument for the backtracking solver : instead of looking for possible numbers in increasing order, you can look for possible numbers in decreasing order also (reverse=True).

One will get the same results iff the puzzle has a unique solution.

The program now checks for multiple solutions after running the difficulty() method.

If a puzzle has two (or more) solutions, __difficulty is set to -3.

I also added a method get_difficulty() to check for (non)-uniquely solvable sudokus.

The same has yet to be done on the diagonal sudoku class