Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Irreducible Sudoku boards ARE potentially solvable

You shouldmust first get a simple reduction pass working Do NOT attempt to solve irreducible boards until you are confident that your simple reductions are working properly!   

But once your simple reduction .   But once that is operational, you can tackle how to deal with irreducible boards.   An irreducible board means that a reduction pass on the board causes no change even though the board contains at least one cell that , at least    To solve an irreducible board,is neither solved nor empty.    To solve an irreducible board, you need to pick a particular unsolved cell from the board using some sort of heuristic to choose what you think is the best cell to work with, and test each of its values one by one to see if they lead to a solved board.  To test a value, pick on of the values, set the cell to have that one value, i.e. to be "solved" and then try to solve the entire board.   If the board is solvable, you're done, otherwise, take the next value choice and repeat. 

'But this trial process requires that you be able to return the board back to its original state before you tried the previous choice!  Luckily, a Board object is capable of making a "deep" copy (clone) of itself which you can save away.  Unluckily, the method to find a cell candidate (findMinChoiceCell) only returns the cell, not its location in the puzzle, so you don't know which cell you actually found (does it matter?).     See below for a tip on one way to get around this problem.

Note that the process of solving an irreducible board may itself encounter an irreducible board which you must then solve, so the overall solving process must fundamentally be a recursive process!

See the code details wiki page for explanations of the return types of the reduction and solving methods of GameModel.

 

To find final solutions from a partial solution, one should look for a square with multiple possible values, generate the different partial solutions by specifying that the square contains one of the values (and impose the restrictions specified by the rules of Sudoku on the content of the other squares), and then recurse for each of these possible solutions until no square has more than one possible value. If square becomes empty, then it will not lead to a final solution. If all squares have exactly one value, then we have a final solution.

...