Help for Quick solving using Patterns
 

All possible patterns for the digits 1-9 in given puzzle state can be readily generated. Such patterns have already been put to good use above in the POM analysis, and solving by patterns in the contradiction set. The nice thing about patterns is that they already (by definition) conform to the sudoku constraints.

It turns out that these patterns (only one of which is the correct one for each digit) can be used to quickly solve a puzzle using the following process:

  • Generate all patterns for each number in separate arrays and order them by increasing size.
  • Take the first pattern for first array (18 digit string, 2 digits for each address) and add each address to a new array .
  • Take the first pattern for next array. If none of the 9 addresses for this coincide with those for the first pattern, then add these to the new array of addresses.
  • If one of the addresses for second array coincides with one of the addresses for the first, then discard it and try second pattern for second array, and so on until one fits.
  • In this way, the process keeps testing patterns to see if they fit, a bit like assembling a jig-saw puzzle.
  • Eventually the array has 81 2-digit addresses representing the final solution (if a valid puzzle).
  • The process continues until all combinations are tested, with the result that there will be zero, one or many solutions. If there is one solution (ie a valid puzzle) then this is displayed.

The following is the diagramatic view of the logic. If pattern 'fits' means taking each of the 9 addresses of the candidate pattern one at a time and seeing if the address is occupied by the existing patterns at that point in the process. If an address is occupied (ie no fit), then the pattern is discarded.

The method doesn't take into account how 'hard' the puzzle is. The more patterns a puzzle state has the longer it takes. It would also be quicker if by chance the correct patterns occured early in the list. For example, the 'golden nugget' after exocet elimination took about 4 seconds to give the first output, while the 'easter monster', following SK loop and naked triplet eliminations, had fewer patterns and took less than 1 second and produced the second output. The Top95, #7, which has no given for number 9, has 2301 patterns for 9, so despite being a much simpler puzzle than GN, it almost takes as long.

Golden Nugget: Total number of patterns:
1: 47
2: 37
3: 89
4: 38
5: 32
6: 96
7: 52
8: 12
9: 16
--------
All: 421

Final answer =
02,15,28,33,47,50,61,74,86,
06,12,23,30,45,57,68,71,84,
07,13,22,31,46,54,60,75,88,
04,16,21,37,42,53,65,78,80,
01,18,24,36,43,52,67,70,85,
05,17,20,38,44,51,63,76,82,
00,14,27,35,41,58,66,72,83,
03,10,26,32,48,55,64,77,81,
08,11,25,34,40,56,62,73,87
Easter Monster: Total number of patterns:
1: 10
2: 10
3: 96
4: 12
5: 16
6: 10
7: 6
8: 96
9: 16
--------
All: 332

Final answer =
00,16,23,32,47,55,61,74,88,
08,10,25,34,41,56,67,73,82,
03,12,27,35,46,50,68,71,84,
02,13,28,30,45,57,64,76,81,
05,17,20,31,48,54,63,72,86,
07,14,22,38,43,51,66,70,85,
01,15,26,37,44,52,60,78,83,
04,18,21,36,42,53,65,77,80,
06,11,24,33,40,58,62,75,87