by carbon14 » Sun Jun 12, 2005 8:13 pm
scrose you have answered my question. I checked out Simes' list and Swordfish is not one of the techniques that I use, but you say that Wayne does not use Swordfish in his puzzles.
These are my techniques, and I have not yet found a Pappacom puzzle which my program does not solve.
Background:
there are many so-called sudoku solving programs out there which seem to use purely Nishio or some such to recursively guess at the puzzle until it works. These can be spotted because they will find a solution even if you give them a blank grid. I wanted to test my logic, so I wrote a 'logical' solver. This will stall if it cannot make any progress.
Basic Premise.
The program starts with a blank grid and fills each cell with 9 candidates.
Then it reads the input to the puzzle, which is a list of clues. For each clue it discards the 8 incorrect candidates in the cell. It will subsequently find these as answers during the 'solving' of the puzzle. When it finds an answer, it discards (crosses out) the appropriate candidates in the other cells in the row, column or box.
Rule 1:
If only 1 cell in a row column or box has a particular candidate digit, then that digit must be the answer for that cell.
Rule 2:
If a cell has only one candidate, then that candidate must be the answer for that cell.
Rule 3:
If a candidate digit appears in the cells of a boxcol, but not it the other cells of that box. Then it cannot be a candidate for the other cells in the column...
If a candidate digit appears in the cells of a boxcol, but not in the other cells of that column, then it cannot be a candidate for the other cells in the box.
As above substituting boxrow for boxcol and row for column.
Rule 4: (a more general case of Rule 2)
If n cells in a box, row or column each contain only the same n candidates. Then those candidates cannot be candidates for other cells in the same box, row or column
Rule 5: (a more general case of Rule 4)
If n cells in a box, row or column between them contain only the n different candidates, then those candidates cannot be candidates for the other cells in the same box, row or column.
I could have discarded Rules 2 and 4 altogether and just used rule 5. But its generality generally proves usefull only a handful of times in even fiendish puzzles. Since it is much more costly for the computer (and for a human) to search for, it is reserved for those occasions when no further progress has been made using the other rules.
Swordfish certainly seems on the face of it to be logically distinct from these rules, and I would like to...
A: Include it in my program for completeness
B: Find some puzzles which require it, to challenge myself further
C: Eventually compile some sudoku which require it.
I guess I might have to try importing some Japanese puzzle books.
I used to do books of cryptic crosswords, but when you've finished the book, you have to go out and get another one.
With sudoku, I'm sure that I could just start again from the beginning and do each puzzle many times before I rembered anything specific about any puzzle.
I was playing some different Japanese number puzzles on Friday, including Hitori. I didn't find any that looked like they would have the purity and staying power of sudoku, but they were certainly fun and challenging and I think that everyone should hunt some out and give them a try. They are published in the same kinds of books.