Pattern Overlay Method

Advanced methods and approaches for solving Sudoku puzzles

Re: Pattern Overlay Method

Postby P.O. » Mon Jan 06, 2025 6:27 am

hi R.Jamil,
whatever the link you give concerning one method or another of resolution by templates their common trait is that they all use the knowledge of all the templates for each value, this example of Dobrichev is a new illustration of it

then the logic used for the elimination of templates is obviously the same for all these methods only the way of expressing it differs and the analysis which leads to putting or removing a candidate once again is the same

regarding the example given by Dobrichev, after initializing the puzzle and retrieving the templates we observe that there are 4 for each of the values ​​6 and 7 and the analysis of their compatibility shows that only 6 instances can be constructed, leading to the exclusion of one of the templates for 7, forcing the cells (50 63 78) to take the value 7 and a grid update solves the puzzle

Code: Select all
.  .  .  .  .  1  .  .  2
.  .  3  .  4  .  .  5  .
.  6  .  7  .  .  8  .  .
.  .  6  .  .  .  .  7  .
.  4  .  .  2  .  .  .  3
1  .  .  .  .  4  9  .  .
.  .  8  .  .  9  5  .  .
.  7  .  8  .  .  .  6  .
6  .  .  .  5  .  .  .  .

.....1..2..3.4..5..6.7..8....6....7..4..2...31....49....8..95...7.8...6.6...5....

#VT: (36 28 54 28 14 4 6 14 42)
Cells: nil nil nil nil nil (54) nil nil nil
SetVC: ( n6r6c9   n1r5c7   n8r5c8   n2r6c8   n4r4c7   n5r4c9
         n8r9c9 )

#VT: (10 14 54 12 7 4 4 4 30)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil (11) nil

45789  589    4579   3569   3689   1      367    349    2               
2789   129    3      269    4      268    67     5      179             
2459   6      12459  7      39     235    8      1349   149             
2389   2389   6      139    1389   38     4      7      5               
579    4      579    569    2      567    1      8      3               
1      358    57     35     378    4      9      2      6               
234    123    8      12346  1367   9      5      134    147             
23459  7      12459  8      13     23     23     6      149             
6      1239   1249   1234   5      237    237    1349   8               
166 candidates.

#6: (7 15 20 30 40 54 59 71 73) (7 13 20 30 42 54 59 71 73)
    (5 16 20 30 42 54 58 71 73) (4 16 20 30 42 54 59 71 73)
 
#7: (7 10 22 35 39 50 63 65 78) (3 16 22 35 37 50 63 65 78)
    (1 18 22 35 42 48 59 65 79) (1 16 22 35 39 50 63 65 78)

1: (6 7) 6 instances

..7...6.......67...6.7.......6....7.7..6.........7...6....6...7.7.....6.6....7...
7.....6.......67...6.7.......6....7...76.........7...6....6...7.7.....6.6....7...
..7...6.....6..7...6.7.......6....7.7....6.......7...6....6...7.7.....6.6....7...
7.....6.....6..7...6.7.......6....7...7..6.......7...6....6...7.7.....6.6....7...
....6.7..7.....6...6.7.......6....7...7..6.......7...6...6....7.7.....6.6....7...
...6..7..7.....6...6.7.......6....7...7..6.......7...6....6...7.7.....6.6....7...

......6.......6....6.........6.........6.............6....6...........6.6........
......6.....6......6.........6...........6...........6....6...........6.6........
....6..........6...6.........6...........6...........6...6............6.6........
...6...........6...6.........6...........6...........6....6...........6.6........

......7..7...........7............7...7..........7............7.7............7...
..7............7.....7............7.7............7............7.7............7...
7..............7.....7............7...7..........7............7.7............7...

#VT: (10 14 54 12 7 4 3 4 30)
Cells: nil nil nil nil nil nil (50 63 78) nil nil
SetVC: ( n7r6c5   n7r7c9   n7r9c6   n5r6c3   n3r6c4   n8r4c6
         n8r6c2   n5r8c1   n5r1c2   n8r1c5   n8r2c1   n5r5c4
         n5r3c6   n6r7c5   n6r5c6   n7r2c7   n2r2c6   n3r8c6
         n2r8c7   n3r9c7   n6r1c7   n1r8c5   n9r1c4   n6r2c4
         n3r3c5   n1r4c4   n9r4c5   n3r1c8 )

#VT: (3 4 2 4 1 1 2 1 2)
Cells: nil nil nil nil nil nil nil nil (11 37)
SetVC: ( n9r2c2   n1r2c9   n9r5c1   n7r5c3   n4r1c3   n2r3c1
         n1r3c3   n3r4c1   n2r4c2   n4r7c1   n2r7c4   n1r7c8
         n9r8c3   n4r8c9   n1r9c2   n2r9c3   n4r9c4   n9r9c8
         n7r1c1   n4r3c8   n9r3c9   n3r7c2 )
7 5 4   9 8 1   6 3 2
8 9 3   6 4 2   7 5 1
2 6 1   7 3 5   8 4 9
3 2 6   1 9 8   4 7 5
9 4 7   5 2 6   1 8 3
1 8 5   3 7 4   9 2 6
4 3 8   2 6 9   5 1 7
5 7 9   8 1 3   2 6 4
6 1 2   4 5 7   3 9 8
P.O.
 
Posts: 1794
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby rjamil » Tue Jan 07, 2025 4:22 am

Hi P.O.,

Wish to inform that I have implemented two-digit POM elimination only move successfully.

I just checked first-digit all templates against second-digit template. If at least one template of second-digit found then count first-digit template cell positions. For example, just check digit 1 all possible templates with one of the digit 2 possible template. Then proceed to perform digit 1 POM elimination only.

For first-digit placement move, need to check at least one of the all other-digits template, i.e., check digit 1 all templates with one of the digit 2, 3, 4, 5, 6, 7, 8 and 9 template.

Partial success achieved.

R. Jamil

Added as on 20250109: My GitHub repositories has been updated accordingly.
rjamil
 
Posts: 796
Joined: 15 October 2014
Location: Karachi, Pakistan

Re: Pattern Overlay Method

Postby rjamil » Fri Jan 17, 2025 12:36 am

Hi experts,

Please note that, I have built Pattern Overlay Method routine for single-digit (univalue both placement and eliminaton move) and two-digit (bivalue elimination move only) successfully, instead of tracking/storing intermediate templates, by just counting possible combination of templates.

Looking here and there for two-digit (or multi-digit) POM placement(s) example with no success.

Found interesting correspondence between ronk and daj95376 here regarding POM.

However, is there any real example available in which bivalue (or multivalue) POM move containing placement(s) (with or without eliminations)?

Similarly, if I'll count all possible templates of digit 1 with one of 2-9 digit possible template each, is it possible then to perform digit 1's single-digit POM placement move too?

R. Jamil
rjamil
 
Posts: 796
Joined: 15 October 2014
Location: Karachi, Pakistan

Re: Pattern Overlay Method

Postby P.O. » Fri Jan 17, 2025 11:18 am

hi R.JAMIL
consider again the second list of puzzles here that are solved with combinations of 2 templates, 74 of these puzzles are solved with only 1 combination of 2 templates, that is to say that these combinations of 2 templates lead to the elimination of templates then the grid is solved either with placement or elimination of candidates

here is the list of 74 puzzles:
(3 4 5 7 8 9 11 12 13 14 15 18 19 21 23 24 25 26 27 28 29 30 31 32 33 34 35 37
38 41 42 45 46 47 48 49 50 52 53 54 56 58 59 60 63 64 65 67 68 69 70 72 74 76
77 78 79 80 82 83 84 85 86 87 88 89 91 92 93 94 96 97 99 100)
P.O.
 
Posts: 1794
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby rjamil » Sat Jan 18, 2025 12:01 am

Hi P.O.,

Thanks for pointing the three test files. Find herewith link to each files output solved with RJSudoku.c program as T1 - 100 single-digit POM puzzles, T2 - 100 double-digit POM puzzles and T3 - 100 triple-digit POM puzzles.

First two files, containing single-digit and double-digit POM move puzzles respectively, are solved without guess completely. However, third file containing triple-digit POM move puzzles, solved with guesses. No POM placement move needed to solve the T1 and T2 puzzles.

Need sample puzzle that need to solve with (bivalue) double-digit POM placement move only.

R. Jamil
rjamil
 
Posts: 796
Joined: 15 October 2014
Location: Karachi, Pakistan

Re: Pattern Overlay Method

Postby P.O. » Sat Jan 18, 2025 3:08 pm

rjamil wrote:First two files, containing single-digit and double-digit POM move puzzles respectively, are solved without guess completely.

i don't agree with this statement because in your T2.txt file it is mentioned 12 times that you use Trial & Error, for puzzles (2 10 13 20 22 44 51 61 73 90 95 98)

your analysis is based entirely on candidate cells and not on template combinations

for example for puzzle 20 we do the same eliminations of candidates until you resort to Trial & Error, but at this point if you had made the combination (2 6) you would have noticed that the number of templates for 6 goes from 14 to 10 and the analysis of the remaining templates would have allowed you to eliminate 6 from the cells (19 20 21) which solves the puzzle
Code: Select all
..3.5.78......9......1....5.1..7.6....45.3......6..9.23728........2......48..5..6

169     269     3       4       5       26      7       8       19               
14567   2568    16      37      368     9       1234    12346   134             
4679    2689    69      1       368     267     234     23469   5               
2       1       5       9       7       8       6       34      34               
69      69      4       5       2       3       18      17      178             
8       3       7       6       14      14      9       5       2               
3       7       2       8       1469    146     5       149     149             
1569    569     169     2       13469   1467    1348    13479   134789           
19      4       8       37      139     5       123     12379   6               
143 candidates.

#VT: (28 6 12 22 2 14 3 4 12)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(72) nil nil nil nil (68 69) nil nil (72)

169    269    3      4      5      26     7      8      19             
14567  2568   16     37     368    9      1234   12346  134             
4679   2689   69     1      368    267    234    23469  5               
2      1      5      9      7      8      6      34     34             
69     69     4      5      2      3      18     17     178             
8      3      7      6      14     14     9      5      2               
3      7      2      8      1469   146    5      149    149             
1569   569    169    2      1349   147    1348   13479  3478           
19     4      8      37     139    5      123    12379  6               
139 candidates.

2combs
#VT: (18 5 12 20 2 14 3 4 8)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(10) nil nil nil nil nil nil nil (19 20)

169    269    3      4      5      26     7      8      19             
4567   2568   16     37     368    9      1234   12346  134             
467    268    69     1      368    267    234    23469  5               
2      1      5      9      7      8      6      34     34             
69     69     4      5      2      3      18     17     178             
8      3      7      6      14     14     9      5      2               
3      7      2      8      1469   146    5      149    149             
1569   569    169    2      1349   147    1348   13479  3478           
19     4      8      37     139    5      123    12379  6               
136 candidates.

2combs
#VT: (18 5 12 20 2 10 3 4 8)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil (19 20 21) nil nil nil
EraseCC: ( n9r3c3   n9r1c9   n1r1c1   n6r2c3   n1r8c3   n9r9c1
           n2r1c2   n6r1c6   n8r3c2   n3r3c5   n6r5c1   n9r5c2
           n5r8c1   n6r8c2   n1r9c5   n5r2c2   n7r2c4   n8r2c5
           n2r3c6   n4r3c7   n6r3c8   n4r6c5   n1r6c6   n4r7c6
           n1r7c9   n9r8c5   n7r8c6   n3r9c4   n2r9c7   n7r9c8
           n4r2c1   n3r2c9   n7r3c1   n4r4c9   n1r5c8   n6r7c5
           n9r7c8   n8r8c9   n1r2c7   n2r2c8   n3r4c8   n8r5c7
           n7r5c9   n3r8c7   n4r8c8 )
1 2 3   4 5 6   7 8 9
4 5 6   7 8 9   1 2 3
7 8 9   1 3 2   4 6 5
2 1 5   9 7 8   6 3 4
6 9 4   5 2 3   8 1 7
8 3 7   6 4 1   9 5 2
3 7 2   8 6 4   5 9 1
5 6 1   2 9 7   3 4 8
9 4 8   3 1 5   2 7 6

same for puzzle 51, we reach the same resolution state before you resort to Trial & Error:
Code: Select all
2combs
#VT: (3 1 4 3 1 2 3 3 1)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil (59) nil nil nil

1      2      3      4      5      68     7      68     9               
4      5      6      7      38     9      18     2      13             
7      8      9      13     136    2      5      36     4               
2      3      4      18     18     7      9      5      6               
5      6      7      9      34     34     2      1      8               
8      9      1      6      2      5      3      4      7               
3      147    8      5      47     46     16     9      2               
6      17     5      2      9      38     4      378    13             
9      47     2      38     34678  1      68     37     5               
56 candidates.

not doing the template combinations you miss the placements of 1 in cells (22 32) and 3 in cells (42 76)
Code: Select all
2combs
#VT: (2 1 2 3 1 2 3 3 1)
Cells: (22 32) nil (42 76) nil nil nil nil nil nil
SetVC: ( n1r3c4   n8r4c4   n1r4c5   n3r5c6   n8r8c6   n3r9c4
         n7r9c8   n6r1c6   n8r1c8   n1r2c7   n3r2c9   n3r3c5
         n6r3c8   n4r5c5   n7r7c5   n4r7c6   n6r7c7   n3r8c8
         n1r8c9   n4r9c2   n6r9c5   n8r9c7   n8r2c5   n1r7c2
         n7r8c2 )
1 2 3   4 5 6   7 8 9
4 5 6   7 8 9   1 2 3
7 8 9   1 3 2   5 6 4
2 3 4   8 1 7   9 5 6
5 6 7   9 4 3   2 1 8
8 9 1   6 2 5   3 4 7
3 1 8   5 7 4   6 9 2
6 7 5   2 9 8   4 3 1
9 4 2   3 6 1   8 7 5

one last example puzzle 61, we reach the same resolution state before you resort to Trial & Error:
Code: Select all
#VT: (1 2 3 6 5 2 2 1 2)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil

1     25    23    4     35    6     7     8     9             
345   45    6     7     8     9     1     2     35             
7     8     9     1     35    2     35    46    3456           
2     457   47    56    49    8     39    1     36             
45    3     8     56    49    1     2     69    7             
9     6     1     3     2     7     4     5     8             
34    9     34    2     6     5     8     7     1             
6     27    27    8     1     3     59    49    45             
8     1     5     9     7     4     6     3     2             
58 candidates.

i make the combinations of templates
a first time, which makes the number of templates go from (1 2 3 6 5 2 2 1 2) to (1 2 3 5 4 2 2 1 2) without modification of the resolution state
Code: Select all
2combs
#VT: (1 2 3 5 4 2 2 1 2)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil

1     25    23    4     35    6     7     8     9             
345   45    6     7     8     9     1     2     35             
7     8     9     1     35    2     35    46    3456           
2     457   47    56    49    8     39    1     36             
45    3     8     56    49    1     2     69    7             
9     6     1     3     2     7     4     5     8             
34    9     34    2     6     5     8     7     1             
6     27    27    8     1     3     59    49    45             
8     1     5     9     7     4     6     3     2             
58 candidates.

as there were template eliminations i make the combinations of templates a second time which makes the number of templates go from (1 2 3 5 4 2 2 1 2) to (1 2 3 4 4 2 2 1 2) which allows the placement of 4 in cell 41 and solves the puzzle
Code: Select all
2combs
#VT: (1 2 3 4 4 2 2 1 2)
Cells: nil nil nil (41) nil nil nil nil nil
SetVC: ( n4r5c5   n9r4c5   n3r4c7   n6r4c9   n5r5c1   n6r5c4
         n9r5c8   n4r8c8   n5r8c9   n3r2c9   n5r3c7   n6r3c8
         n4r3c9   n5r4c4   n9r8c7   n4r2c1   n5r2c2   n3r3c5
         n3r7c1   n4r7c3   n2r1c2   n3r1c3   n5r1c5   n7r4c3
         n7r8c2   n2r8c3   n4r4c2 )
1 2 3   4 5 6   7 8 9
4 5 6   7 8 9   1 2 3
7 8 9   1 3 2   5 6 4
2 4 7   5 9 8   3 1 6
5 3 8   6 4 1   2 9 7
9 6 1   3 2 7   4 5 8
3 9 4   2 6 5   8 7 1
6 7 2   8 1 3   9 4 5
8 1 5   9 7 4   6 3 2

my point of view regarding the technique of resolution by templates is that the placement or elimination of candidates is the consequence of the elimination of templates realized by their combinations
you cannot make these combinations if you do not have all the templates for each value

in your T3.txt file you have used Trial & Error more than 200 times which is an indication that the more the size of the combinations increases the less the method you are using gives results
P.O.
 
Posts: 1794
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby rjamil » Sat Jan 18, 2025 6:31 pm

Hi P.O.,

First of all, many thanks for your prompt response. I really appreciate your assistance.

I have coded for single-digit POM placement and eliminaion move and double-digit POM elimination move only. Similarly, I haven't coded for triple-digit POM move.

I need experts guidance for double-digit POM move at the moment, as it need to be checked and confirmed by experts (or just by your goodself) on its fitness. Actually, I considered 88 puzzles solved without guess means it is almost same results with yours, i.e., 74 puzzles solved with only one combination of double-digit POM move.

However, my single-digit POM placement and elimination move is supposed to be correct. if there is any bug in the same then it will be identified in T1.txt file.

Your detail reply help to do thorough investigation and debug the double-digit POM elimination move routine accordingly. However, is there any double-digit POM placement move present?

R. Jamil
N.B.: I have changed univalue with single-digit, bivalue with double-digit wordings. Similarly, plan to use triple-digit and quad-digit for POM move accordingly.
rjamil
 
Posts: 796
Joined: 15 October 2014
Location: Karachi, Pakistan

Previous

Return to Advanced solving techniques