by Claude W Smith
(San Diego, CA)
Recently, My wife asked me to find a computer program so that she could play the game on her home computer. As her computer is not Intel x86 based, I decided to write a Sudoku program for her using an old programing language.
To make a program that she could play, was quite easy, but I went the extra mile, and started to program the thing to solve the puzzle without any guesswork. ( Pure Logic Only ).
During the programming of the solution, I found the concept of a list of possible values for each cell, did not work too well. So, I came up with another strategy that works quite well in my programming. ( So far so good. )
The concept is to give each cell a 'Reject' list. There are 81 cells, therefore, there are 81 'Reject' lists.
START:
For each cell(A), the computer first clears the 'Reject(A)' list for cell(A).
LOOP_REJECT:
For each cell:
1) If cell(A) is filled, the 'Reject(A)' list is every value, So, if cell(A) is '4', the 'Reject(A) == '123456789'.
2) If cell(A) is empty, The computer examines each and every cell(B) that is in that cell(A)'s ROW, COLUMN and HOOD(3x3 Square). If, any cell(B) is filled, the computer adds cell(B)'s value to the 'Reject(A)' list.
3) Loops back to LOOP_REJECT: 81 times.
REJECT_EXAMINE:
After that is done, for each cell(A), the computer then makes a long EXAMINE string of:
1) All the 'Reject(B)' lists of the cells in the same ROW.
2) All the 'Reject(B)' lists of the cells in the same COLUMN.
3) All the other 'Reject(B)' lists of the cells in the same HOOD(3x3 Square).