2013-12-26 12:57:22 UTC
It first finds all "simple forced" cells. I define those to be the cells for which (a) there is a number which can go into that cell, but cannot go into any other cell in the row, column, or 3x3 subsquare, or (b) there is only one number that can go into it.
If you look at each square, and note all the numbers that are not eliminated because it already occurs in the row, column, or subsquare, then a number is forced if it occurs only one time in a row, column or subsquare, or is the only number for that square.
Nothing special in all that--it's the way most people would start a methodical solution for a Sudoku, by writing down the allowed numbers for each cell, and then examining them.
For all but the easiest puzzles, you will run out of "simple forced cells" and will have to resort to "deeper" logic, or start making guesses to see if a guess leads to a contradiction, and then start over.
An example of deeper logic would be having 23 23 27 as the only possibilities for three cells in a given row, column or subsquare. You know the cells with 2 and 3 must have a 2 and a 3 in some order, so the cell that can only be 2 or 7 must be 7.
Deeper logic is harder to program, and comes in more varieties, so my spreadsheet takes the guessing approach. It looks at all numbers that haven't been eliminated, plugs them in one at a time, and sees if there is a contraction or if that guess results in a solution, based on finding "simple forced" numbers. If it doesn't find a solution, it backs up and tries another guess.
So far, even for the hardest puzzles (like with minimal 17 clues), it has found a single guess that results in finding the full solution. It takes the cells in order, so if such a key guess is close to the start, it will go quickly (< 5 seconds). If not, it may take up to 2 minutes to find the right guess among the hundred or so possible guesses.
My question is, once all the "simple forced" numbers are found, will there always be 1 guess that will result in all of the other numbers being "simple forced"? (In other words, will my spreadsheet design always be able to find a solution?)