Pattern Overlay Method

Advanced methods and approaches for solving Sudoku puzzles

Pattern Overlay Method

Postby P.O. » Thu Jul 28, 2022 5:22 am

the purpose of this post is to describe my implementation of the Pattern Overlay Method. i am well aware that i am going to repeat what most readers of this forum already know very well.

the 81 cells of a Sudoku grid are indexed from 1 to 81 in row order, they can also be indexed with a Row Col Box coordinate system, the conversion from one system to the other give this equivalence:
Code: Select all
      1        2        3        4        5
   (1 1 1)  (1 2 1)  (1 3 1)  (1 4 2)  (1 5 2)
   
     10       11       12       13       14
   (2 1 1)  (2 2 1)  (2 3 1)  (2 4 2)  (2 5 2)

two cells are connected if they have at least one of the R C or B coordinates equal, otherwise they are disconnected
a template is a set of nine cells pairwise disconnected
n templates are compatibles if their sets of cells are pairwise disjoint
a puzzle solution is composed of nine compatible templates, one for each of the nine values

it is relatively fast to compute the templates:
Code: Select all
for i in B1(9) j in B2(6) k in B3(3)
    l in B4(6) m in B5(4) n in B6(2)
    o in B7(3) p in B8(2) q in B9(1) gives the 46656 (i j k l m n o p q) templates

the algorithm is four cases in a loop
Code: Select all
 (loop
    (case key(1234)
     (1)
     (2)
     (3)
     (4)
    )
   )

two variables are used: key to select the case and combTP from 2 to 8 to select the number of templates to check for compatibility

before the loop begins
-the puzzle is initialized
-a scan for Singles is done, if needed the grid is updated
-the key is set to 1

case 1:
a pattern for a value is the set of cells for that value
a valid template for a value is a template with the pattern of the value as a subset and compatible with the others patterns
candidates for a value is the set of cells with this value as candidate

for each value:
-the pattern is computed
-the valid templates are computed
-the candidates are computed
the key is set to 2
combTP is set to 2

case 2:
for each value the intersection of all its valid templates is done to see if some cells are common to all
if so
-the cells are set to this value and a scan for Singles is done
--if the grid is solved the loop is exited if not the key is set to 1
if not
-the key is set to 3

case 3:
for each value the set-difference between the set of the candidate cells and the set of the cells of all the valid templates is done to see if some candidate cells are not in any templates
if so
-the value is eliminated from these cells and a scan for Singles is done
--if the grid is solved the loop is exited
--if not if some singles have been set the key is set to 1
--if not the candidates are updated the key is set to 4
if not the key is set to 4

case 4:
the valid templates are tested for compatibility by group of combTP in the range 2 to 8
to be compatible a template must be a least in one of the combinations of its group
for example: there are m templates for 1 n for 2, a template for 1 to be valid must be compatible with at least one of the templates for 2
if some are found incompatibles they are removed from the valid templates the key is set to 2 combTP is set to 2
if not combTP is incremented the key is set to 4

of course there are practicalities issues and some optimization to do to manage the combinatoric explosion that happen sometimes.

as a example of its working the output of the algorithm for PG 375
1..2..3.4.3..4..5...6..3..17..8..1...1..7..8...9..4..75..4..6...9..2..1.3.1..8..2 10.4/10.4/9.9

Hidden Text: Show
Code: Select all
#VT: (2 18 6 5 36 20 32 16 36)                              for each value number of valid templates
Cells:     nil nil nil nil nil nil nil nil nil                      ""     cells common to all templates
Candidates:nil nil nil nil nil nil nil nil nil                      ""     cells present in none of the templates
2                                                           combination of templates tested for compatibility
#VT: (2 18 6 5 36 18 32 16 34)
Cells:     nil nil nil nil nil nil nil nil nil             
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 18 6 5 30 17 32 16 34)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (2 18 6 5 30 17 31 16 28)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (2 18 6 5 30 17 30 16 28)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4 5
#VT: (2 15 6 5 23 13 22 14 19)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil (23)
2 3 4
#VT: (2 15 6 5 22 13 21 14 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 14 6 5 22 13 21 14 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4 5
#VT: (2 7 6 5 9 9 12 8 11)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil (19 30 35 47) nil nil (32 39 49 70) (33) (67) (10) (16 33)
2
#VT: (2 7 6 5 9 9 12 7 11)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 6 6 5 9 7 11 7 11)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil (39) nil nil nil (42 76) nil nil nil
2 3 4
#VT: (2 3 4 3 7 5 10 5 10)
Cells:     nil (12 33 56) nil nil nil nil nil nil nil             
SetVC: ( n2r2c3   n2r4c6   n2r7c2   n9r2c1 )                       values set in cells

#VT: (2 3 6 5 28 18 20 10 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil (25) nil
2
#VT: (2 3 6 5 28 16 18 10 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 6 5 22 14 14 10 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil (43) nil (6) nil nil                 
2 3
#VT: (2 3 6 5 22 13 14 10 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (2 3 6 4 16 11 12 9 12)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil (37 50) nil nil nil
2 3
#VT: (2 3 6 4 14 11 10 9 11)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 6 4 14 10 10 9 10)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 6 3 14 10 10 8 8)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil (30 64) nil nil nil nil nil
2 3
#VT: (2 3 6 3 13 10 10 8 8)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil (50) nil nil nil nil
2 3 4
#VT: (2 3 5 3 8 5 8 8 6)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (49) nil (36 67) (13 32 36 67) nil nil (5 35)
EraseCC: ( n3r8c4 )                                                       values set in cells

#VT: (2 3 4 5 25 13 15 10 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (2 3 4 5 23 12 14 10 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 4 4 18 9 11 10 12)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 4 4 17 9 9 10 12)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 4 4 16 8 9 10 12)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 4 3 15 8 9 9 9)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 3 4 3 12 8 8 8 9)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (2 3 4 3 3 5 4 6 6)
Cells:     nil nil nil nil (30 52 72) (64) nil nil nil
SetVC: ( n5r4c3   n5r6c7   n6r8c1   n5r8c9   n7r8c6   n3r5c3
         n4r8c3   n6r9c5   n8r8c7   n8r7c3   n7r1c3   n7r2c7
         n7r9c2   n1r2c4   n6r2c6   n8r2c9   n6r6c4   n8r6c2
         n5r1c2   n8r1c5   n9r1c6   n6r1c8   n4r3c2   n5r3c5
         n6r4c2   n5r5c6   n2r6c1   n3r6c8   n1r7c6   n8r3c1
         n7r3c4   n4r4c8   n9r4c9   n4r5c1   n9r5c4   n2r5c7
         n6r5c9   n1r6c5   n9r7c5   n7r7c8   n3r7c9   n5r9c4
         n9r9c8   n9r3c7   n2r3c8   n3r4c5   n4r9c7 )
1 5 7   2 8 9   3 6 4
9 3 2   1 4 6   7 5 8
8 4 6   7 5 3   9 2 1
7 6 5   8 3 2   1 4 9
4 1 3   9 7 5   2 8 6
2 8 9   6 1 4   5 3 7
5 2 8   4 9 1   6 7 3
6 9 4   3 2 7   8 1 5
3 7 1   5 6 8   4 9 2

(2 2 3 2 3 4 2 3 4 2 3 4 5 2 3 4 2 3 2 3 4 5 2 2 3 2 3 4 2 2 3 2 3 2 3 4 2 3 2       recap of combinations tested
 3 2 3 2 3 2 3 4 2 2 3 2 3 2 3 2 3 2 3 2 3 4)
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby P.O. » Thu Jul 28, 2022 6:59 am

another example: Easter Monster
1.......2.9.4...5...6...7...5.9.3.......7.......85..4.7.....6...3...9.8...2.....1
Hidden Text: Show
Code: Select all
#VT: (41 39 130 32 18 41 8 148 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (33 35 130 32 18 33 8 148 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (31 35 130 32 18 33 8 147 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (10 11 130 32 18 10 6 147 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:(23 39 43 57 59) (19 23 37 43 59) nil nil nil (5 37 45 73 77) (3) nil nil
2 3
#VT: (10 10 125 32 18 10 6 146 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (10 10 124 32 18 10 6 146 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (7 7 90 12 18 7 6 117 18)
Cells:     nil nil nil (42) nil nil nil nil nil
SetVC: ( n4r5c6 )

#VT: (31 30 130 16 18 31 8 148 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (25 26 130 16 18 25 8 146 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (24 26 130 16 18 25 8 145 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (6 6 120 16 18 6 5 126 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (6 6 117 16 18 6 5 123 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (6 6 103 16 17 6 5 92 18)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (6 6 55 11 13 6 5 48 16)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (14 44) (68) nil nil nil (14 38) (44)
2 3
#VT: (6 6 53 11 13 6 5 46 16)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (6 6 48 11 13 6 5 34 16)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (6 6 47 11 13 6 5 34 16)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4 5
#VT: (5 5 20 9 8 6 5 12 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:(47 60) (51 58) nil (19 56) (67) nil nil (15) nil
2 3
#VT: (5 5 18 9 8 6 5 11 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (5 5 10 9 8 6 5 9 12)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (3 8 18 22) nil nil nil nil (2) nil
2 3
#VT: (5 5 10 9 8 6 5 9 11)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (4 5 7 9 7 4 3 5 8)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:(15 52) nil (52) nil (24 76) (4 28 44 67) (6 36) (3 16 23 28 45 78) nil
2
#VT: (4 5 7 8 7 4 3 5 8)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (4 4 6 6 7 2 3 5 5)
Cells:     nil nil nil nil nil (14 8 36 64) nil nil nil
SetVC: ( n6r1c8   n6r2c5   n8r2c9   n6r4c9   n6r8c1   n1r2c7 )

#VT: (16 22 56 14 14 2 5 36 14)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (19) nil nil nil nil nil nil
2
#VT: (14 17 55 11 14 2 3 35 14)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (14 17 54 11 14 2 3 33 14)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (11 9 35 11 14 2 3 29 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (11 9 32 11 14 2 3 29 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (8 9 30 11 14 2 3 29 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (8 9 28 11 14 2 3 28 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (3 4 17 8 9 2 3 18 9)
Cells:     (56) nil nil nil nil nil nil nil nil
SetVC: ( n1r7c2 )

#VT: (6 22 56 11 14 2 5 28 14)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (5 17 55 9 14 2 3 27 14)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (5 17 53 9 14 2 3 25 14)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (4 7 31 9 14 2 3 19 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil (35) nil nil nil nil nil nil nil
2
#VT: (4 7 26 9 14 2 3 19 13)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (3 7 25 6 12 2 3 19 11)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (3 7 22 6 12 2 3 19 10)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (62) nil nil nil nil nil nil
2 3
#VT: (3 7 19 6 11 2 3 16 10)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3 4
#VT: (3 4 8 6 6 2 3 7 6)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (48 76) nil nil nil nil nil (48)
2
#VT: (3 4 7 6 6 2 3 7 6)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (3 4 5 6 5 2 3 6 5)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil (24) nil
2
#VT: (3 4 5 6 5 2 3 5 4)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil (43)
2 3
#VT: (3 4 5 5 5 2 3 5 3)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil (63) nil nil nil nil (27 62)

EraseCC: ( n2r7c8   n1r5c8   n7r4c8   n7r8c9   n4r3c9 )

#VT: (3 12 24 5 10 2 4 28 6)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (3 9 22 5 10 2 2 20 6)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (3 9 20 5 10 2 2 19 6)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 6 11 4 4 2 2 11 6)
Cells:     nil nil nil nil (45) nil nil nil nil
SetVC: ( n5r5c9 )

#VT: (3 12 16 5 7 2 4 28 4)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil (46)
2
#VT: (3 9 9 5 7 2 2 20 3)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil (79) nil nil nil nil nil (79)
2
#VT: (3 9 8 5 7 2 2 16 3)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 6 4 4 4 2 2 9 3)
Cells:     nil nil nil nil nil nil nil nil nil
Candidates:nil (47) (5) nil (57 78) nil nil nil nil
2 3
#VT: (2 6 3 4 4 2 2 5 3)
Cells:     nil nil nil nil nil nil nil (34) nil
SetVC: ( n8r4c7   n3r5c7   n9r6c9   n3r7c9   n9r9c8   n9r1c7
         n3r3c8   n2r6c7   n5r7c4   n8r7c6   n8r1c5   n5r1c6
         n9r3c5   n3r6c1   n4r7c5   n3r9c5   n4r1c3   n2r2c1
         n7r2c6   n8r3c2   n4r4c1   n1r4c3   n2r4c5   n6r5c4
         n7r6c3   n1r6c6   n9r7c3   n5r8c3   n1r8c5   n4r8c7
         n8r9c1   n4r9c2   n7r9c4   n6r9c6   n5r9c7   n7r1c2
         n3r1c4   n3r2c3   n5r3c1   n2r3c6   n9r5c1   n2r5c2
         n8r5c3   n6r6c2   n2r8c4   n1r3c4 )
1 7 4   3 8 5   9 6 2
2 9 3   4 6 7   1 5 8
5 8 6   1 9 2   7 3 4
4 5 1   9 2 3   8 7 6
9 2 8   6 7 4   3 1 5
3 6 7   8 5 1   2 4 9
7 1 9   5 4 8   6 2 3
6 3 5   2 1 9   4 8 7
8 4 2   7 3 6   5 9 1

(2 2 3 2 3 4 2 3 2 3 2 3 4 2 2 3 2 3 4 2 2 3 2 3 4 2 3 2 3 4 2 3 4 2 3 4 5 2 3
 2 3 4 2 3 2 3 4 2 2 3 2 2 2 3 2 2 3 2 3 2 3 4 2 2 2 3 2 2 3 2 2 3 2 3 4 2 2 3
 2 2 3 2 2 2 3 2 2 2 3 2 3)
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby P.O. » Fri Sep 02, 2022 5:20 am

after some optimization a few more POM solutions.
the solving method is to test for compatibility between combinations of templates and to eliminate those that dont fit in any combination.

the main resolution process is a BFS simplest-first algorithm, all the combinations of two templates are tested then all the combinations of three etc., when templates are eliminated the process restarts at two.
the sudoku grid evolves in two ways, for each value
--when all the templates have cells in common theses cells are set to that value
--when candidates are in none of the templates they are eliminated
then a scan for singles is done and the grid is updated.
this main process works fine except for puzzles with a huge amount of template combinations like this one:
http://forum.enjoysudoku.com/post209979.html#p209979
..3......4...8..36..8...1...4..6..73...9..........2..5..4.7..686........7..6..5..
#VT: (241 256 29 88 88 4 22 21 224) : number of templates after initialization.
for those i ressort to another strategy, i directly test combinations of five or six templates one at a time and keep testing at that level after eliminations.
so far i haven't found any puzzle that require more than a combination of six templates to be solved.
i have to ressort to that second strategy because of the slowness of my programming environment, i use a lisp interpreter.
here are some puzzles, sorted by maximum number of template combinations needed to solve them, mainly from this list:
http://forum.enjoysudoku.com/post216295.html#p216295

6-templates
........7.2.4...6.1.....5...9...2.4....8..6..6..9.......5..3....3..8..2.7....4..1 tungsten rod
#VT: (42 10 113 24 42 28 57 144 88)
.......12........3..23..4....18....5.6..7.8.......9.....85.....9...4.5..47...6... platinum blonde
#VT: (65 111 94 34 12 50 73 24 47)
..3......4...8..36..8...1...4..6..73...9..........2..5..4.7..686........7..6..5.. eleven 6539 second strategy
#VT: (241 256 29 88 88 4 22 21 224)
this puzzle is also the first of the following list, those of the list that i tested need 6 templates and their breaking point is the combination (1 2 5 6 7 9) after which the number of templates collapses.
http://forum.enjoysudoku.com/post206442.html#p206442
1...5......7..9.3...9..754...4..3.7..6........9.8........79..2......24.3..2...... eleven 2548 second strategy
#VT: (195 106 18 28 72 201 4 212 14) breaking combination: (1 5 6 7 8 9)
1..4....9.56..9.......1..6..6....8..5....4.9.9....5.1..7....2..6....1.5....3..... eleven 25832 second strategy
#VT: (5 212 196 105 3 16 258 308 11) breaking combination: (2 3 5 6 7 8)

5-templates
.......39.....1..5..3.5.8....8.9...6.7...2...1..4.......9.8..5..2....6..4..7..... golden nugget
#VT: (47 37 108 38 32 96 52 12 16)
12.3.....4.....3....3.5......42..5......8...9.6...5.7...15..2......9..6......7..8 Kolk
#VT: (82 12 38 116 12 34 41 42 42)
..3..6.8....1..2......7...4..9..8.6..3..4...1.7.2.....3....5.....5...6..98.....5. imam bayildi
#VT: (51 31 44 37 26 8 38 20 133)
1.......9..67...2..8....4......75.3...5..2....6.3......9....8..6...4...1..25...6. eleven 5
#VT: (31 9 98 47 22 12 118 31 59)
12.4..3..3...1..5...6...1..7...9.....4.6.3.....3..2...5...8.7....7.....5.......98 discrepancy
#VT: (36 64 11 30 22 73 34 50 78)
12.3.....34....1....5......6.24..5......6..7......8..6..42..3......7...9.....9.8. cigarette
#VT: (128 18 18 20 148 36 33 30 58)
.2..5.7..4..1....68....3...2....8..3.4..2.5.....6...1...2.9.....9......57.4...9.. cheese
#VT: (30 10 44 57 12 36 102 34 25)
........3..1..56...9..4..7......9.5.7.......8.5.4.2....8..2..9...35..1..6........ fata morgana
#VT: (24 150 49 154 9 51 66 65 7)

4-templates
12.3.....4.5...6...7.....2.6..1..3....453.........8..9...45.1.........8......2..7 patience
#VT: (24 16 26 28 29 48 67 40 203)
12.3....435....1....4........54..2..6...7.........8.9...31..5.......9.7.....6...8 red dwarf
#VT: (23 116 26 27 22 33 52 52 21)
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby coloin » Sun Dec 04, 2022 3:18 pm

Just seen your above posts - very informative.

The filter for a lot of thse early hard puzzles was suexratt - and it is interesting that the higest suexratt rating puzzle by eleven has those many template combinations.

Going along along with the template combinations is a high pencil mark [pm] count ....

This puzzle with fewer clues has almost as many pms ...posted here perfect-18-1

I wonder what POM makes of that puzzle !
coloin
 
Posts: 2382
Joined: 05 May 2005
Location: Devon

Re: Pattern Overlay Method

Postby Mathimagics » Sun Dec 04, 2022 4:13 pm

P.O. wrote:
... the slowness of my programming environment, i use a lisp interpreter.


Zounds! :o

So your other car is a cdr ? ;)
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: Pattern Overlay Method

Postby totuan » Sun Dec 04, 2022 4:14 pm

coloin wrote:The filter for a lot of thse early hard puzzles was suexratt - and it is interesting that the higest suexratt rating puzzle by eleven has those many template combinations.

Hidden Text: Show
Code: Select all
Rating Program: dukuso's suexratt
Rating: 5796
Poster: eleven
Label: HardestSudokusThread-01418;coloin
 . . 3 | . . . | . . .
 4 . . | . 8 . | . 3 6
 . . 8 | . . . | 1 . .
-------+-------+------
 . 4 . | . 6 . | . 7 3
 . . . | 9 . . | . . .
 . . . | . . 2 | . . 5
-------+-------+------
 . . 4 | . 7 . | . 6 8
 6 . . | . . . | . . .
 7 . . | 6 . . | 5 . .

Yes, but it's not hard by exocets :D

totuan
totuan
 
Posts: 230
Joined: 25 May 2010
Location: vietnam

Re: Pattern Overlay Method

Postby P.O. » Sun Dec 04, 2022 6:35 pm

Perfect-18-1

the puzzle is in 3-template but it takes a lot to solve it, there is certainly a path with a number of three combinations shorter than the two orders that i currently use: the lexical order and an order based on a estimated number of templates per combination, but my implementation is too slow to try them all.

what is remarkable with this puzzle is the number of possible templates for a value at the beginning, 5894 for value 9, i don't remember having seen such a number for a puzzle with an unique solution,

but by experimenting, i know that the amount of possible templates at the beginning is not a characteristic of difficult puzzles only and this puzzle is another example

templates and candidates are correlated as i try to show in another post:
for each value consider two sets of cells, the set in which the value is set, the Value Cells and the set in which the value is a candidate, the Candidate Cells, for each value to compute the templates consists in organizing the candidate cells into subsets of (9-#VC) pairwise disconnected cells, the Complementary Sets, one template is the Value Cells + one Complementary Set.

the difficulty with this puzzle is to find a 'short' solution, as it has no 1-antibackdoor it needs a least two eliminations and indeed it has 12 2-antibackdoor, it remains to find a logical way to use them:
n4r7c2 with anyone of (n2r2c2 n6r2c7 n3r3c9 n6r4c4 n2r5c1 n6r5c8 n3r6c2 n7r6c6 n2r6c7 n3r8c1 n5r9c3 n3r9c7)


as for my other car, i have a whole bunch :lol:
http://clhs.lisp.se/Body/f_car_c.htm#car

Hidden Text: Show
Code: Select all
.....1..2..3....4..5..6.........2.3..7....8..6..4........3..5....2.7....1.......6

#VT: (56 5 5 64 59 6 70 677 5894)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil (14 76) (41) nil nil nil nil nil nil
2
#VT: (33 4 4 45 53 5 53 575 4668)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil (53) (65) nil nil (7) nil nil nil
2
#VT: (33 4 4 45 53 5 53 571 4569)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (5 4 4 25 30 4 29 282 1615)
Cells: (21 29) nil nil nil nil nil nil nil nil
SetVC: ( n1r3c3   n1r4c2 )

#VT: (9 4 4 25 30 4 29 282 1615)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil (37 69 79) (5 31 37 44 51) (42 67) (24 79) (5 11 24 47) (5 11 24 37 44 47 79)
2
#VT: (6 4 4 18 30 4 27 200 1144)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(71 72) nil nil (60) nil nil nil nil nil
2
#VT: (6 4 4 18 30 4 27 200 1127)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (4 3 4 17 27 4 21 147 748)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(44 63) (80) nil nil nil nil (18 53) nil nil
2
#VT: (4 3 4 17 27 4 21 140 744)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (4 3 4 8 23 4 14 113 535)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil (57 59 64 72 74 75) nil nil (62) (59 62) (59 62)
2
#VT: (4 3 3 8 23 4 14 110 492)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil (70) nil nil nil nil nil nil
2
#VT: (4 3 3 8 23 4 14 110 484)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (4 2 2 8 22 4 14 83 356)
Cells: nil (44 47 59 79) (37 72 74) nil nil nil nil nil nil
SetVC: ( n3r5c1   n2r5c8   n2r6c2   n2r7c5   n1r7c8   n3r8c9
         n3r9c2   n2r9c7   n6r2c2   n1r8c4   n6r8c6   n6r4c7
         n6r5c4   n6r7c3   n6r1c8   n4r8c7   n5r6c8   n5r8c1
         n5r2c9   n5r1c4   n1r2c7 )

#VT: (2 2 2 7 3 1 14 83 356)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2
#VT: (2 2 2 6 3 1 4 19 77)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil (7 10 19 22) (10 19 22 75) nil
2
#VT: (2 2 2 6 3 1 4 17 47)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (2 2 2 4 3 1 2 3 7)
Cells: nil nil nil nil nil nil (15 31 52) nil nil
SetVC: ( n7r2c6   n7r4c4   n7r6c7 )

#VT: (2 2 2 4 3 1 2 3 7)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil (1) nil nil nil (32 48 56 77 78) (1 3 25 26 51 55 63 77 78)
EraseCC: ( n3r3c7   n9r6c3   n1r6c9   n7r9c3   n9r1c7   n4r3c6
           n5r9c6   n3r1c5   n9r5c6   n4r5c9   n8r6c5   n3r6c6
           n8r7c6   n7r7c9   n9r9c4   n4r9c5   n8r9c8   n9r2c5
           n2r3c4   n7r3c8   n8r3c9   n5r4c5   n9r4c9   n5r5c3
           n1r5c5   n4r7c1   n9r7c2   n8r8c2   n9r8c8   n4r1c2
           n8r1c3   n2r2c1   n8r2c4   n9r3c1   n8r4c1   n4r4c3
           n7r1c1 )
7 4 8   5 3 1   9 6 2
2 6 3   8 9 7   1 4 5
9 5 1   2 6 4   3 7 8
8 1 4   7 5 2   6 3 9
3 7 5   6 1 9   8 2 4
6 2 9   4 8 3   7 5 1
4 9 6   3 2 8   5 1 7
5 8 2   1 7 6   4 9 3
1 3 7   9 4 5   2 8 6
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby Mathimagics » Thu Dec 08, 2022 7:11 pm

P.O. wrote:what is remarkable with this puzzle is the number of possible templates for a value at the beginning, 5894 for value 9
I don't remember having seen such a number for a puzzle with a unique solution

Well, that got me thinking! :roll:

The obvious question arises, just how big can this be?

This value, MNVT (max number of valid templates) can be viewed as yet another attribute of valid puzzles that can be used to "rate" a puzzle. Just like MNT (the maximum number of templates that need to be combined to solve the puzzle with POM).

This is worth a thread of its own, I think.

Meanwhile, I have found this puzzle with MNVT = 5936:

Code: Select all
.2....7.....18...6...........4..7..8..6.....1..8..5......64.....9.....5.7......2. (no singles)

NVT(1...9) = {76, 30, 5936, 79, 32, 6, 6, 23, 598}


Cheers
MM
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: Pattern Overlay Method

Postby P.O. » Thu Dec 08, 2022 9:14 pm

i agree, it is certainly interesting to know the answer; as the number of templates is related to the number of candidates, 17 clues puzzles with no clue for one value might be the right place to look.
the MNT gives an idea of the difficulty of a puzzle, i wonder what this number indicates;

as a start here a first list, the other puzzles than yours come from the Homework 7 thread
Code: Select all
.2....7.....18...6...........4..7..8..6.....1..8..5......64.....9.....5.7......2.       Mathimagics
#VT: (76 30 5936 79 32 6 6 23 598)   = 5936 mnvt
#VC:(2 2 0 2 2 3 3 3 1)              = 18 clues
#CC:(30 29 63 31 29 17 16 21 46)     = 282 candidates

.....1..2..3....4..5..6.........2.1..4....5..6..7.........8.6....15.....2.......7       coloin
#VT: (8 2 681 103 5 5 75 675 5904)   = 5904 mnvt
#VC:(3 3 1 2 3 3 2 1 0)              = 18 clues
#CC:(17 16 46 31 17 17 31 46 63)     = 284 candidates

.....1..2..3....4..5..6.........2.3..7....8..6..4........3..5....2.7....1.......6       coloin    Perfect-18-1
#VT: (56 5 5 64 59 6 70 677 5894)    = 5894 mnvt
#VC:(2 3 3 2 2 3 2 1 0)              = 18 clues
#CC:(31 17 17 31 31 17 31 46 63)     = 284 candidates

....12..3..4....5..6..........1...7.8.....4..2....3......5..2....7.4....1.......8       JPF
#VT: (28 5 73 2 77 454 66 64 5883)   = 5883 mnvt
#VC:(3 3 2 3 2 1 2 2 0)              = 18 clues
#CC:(23 17 31 17 31 44 31 30 63)     = 287 candidates

........1..2..3....4..5..6......73...8.4.....1.......2...1...8...7...4..3...6....       coloin
#VT: (2 85 2 7 867 70 55 60 5725)    = 5725 mnvt
#VC:(3 2 3 3 1 2 2 2 0)              = 18 clues
#CC:(16 31 17 18 47 31 31 31 63)     = 285 candidates
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby Mathimagics » Fri Dec 09, 2022 7:21 am

From the known 17C puzzles:

Code: Select all
...4.6.........12.......5..2........5.1..8..........47.7..1...8.6.9.........2.... # 5984
..34...........12........6...4.....7....61.3.8.............7..861..2.......5..... # 6229
.2...67....6...........1.4..94.............15.........5.1.4.......3..92.........7 # 6276
1....6...4...........2..5.......7.4.......9...68.1........4...8..29.....7.......1 # 6698  **


A search of known 18C puzzles found these:
Code: Select all
1...............36..82.......5...4...7....8......13....3.....1.6.......7...845... # 6256
......7.9.5.1......8...3...23..9........7..1.....4..5......8......5....39.4...... # 6288
..34.6.........2....9...5...4.....93....28....6.......5.......48......6....31.... # 6290


So 6698 looks like the maximum.
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: Pattern Overlay Method

Postby P.O. » Fri Dec 09, 2022 9:05 am

well that was fast, so the winner is this one:
Code: Select all
1....6...4...........2..5.......7.4.......9...68.1........4...8..29.....7.......1
#VT: (6 82 6698 8 720 102 92 68 60) = 6698 mnvt
#VC:(3 2 0 3 1 2 2 2 2)             = 17 clues
#CC:(18 31 64 17 46 31 33 31 31)    = 302 candidates

a beautiful PM of course:
Code: Select all
1        235789   3579     34578    35789    6        23478    23789    23479             
4        235789   35679    13578    35789    13589    123678   1236789  23679             
3689     3789     3679     2        3789     13489    5        136789   34679             
2359     12359    1359     3568     235689   7        12368    4        2356             
235      123457   13457    34568    23568    23458    9        1235678  23567             
2359     6        8        345      1        23459    237      2357     2357             
3569     1359     13569    13567    4        1235     2367     235679   8                 
3568     13458    2        9        35678    1358     3467     3567     34567             
7        34589    34569    3568     23568    2358     2346     23569    1             

it is solved with basics:
Hidden Text: Show
Code: Select all
intersections:
((((9 0) (7 8 9) (2 3 5 6 7 9)) ((9 0) (9 8 9) (2 3 5 6 9)))
 (((7 0) (6 7 6) (2 3 7)) ((7 0) (6 8 6) (2 3 5 7)) ((7 0) (6 9 6) (2 3 5 7)))
 (((4 0) (6 4 5) (3 4 5)) ((4 0) (6 6 5) (2 3 4 5 9)))
 (((2 0) (1 2 1) (2 3 5 7 8 9)) ((2 0) (2 2 1) (2 3 5 7 8 9))))

QUINTE ROW: ((5 1 4) (2 3 5)) ((5 4 5) (3 5 6 8)) ((5 5 5) (2 3 5 6 8)) ((5 6 5) (2 3 5 8)) ((5 9 6) (2 3 5 6))
(((5 2 4) (1 3 4 5 7)) ((5 3 4) (1 3 4 5 7)) ((5 8 6) (1 2 3 5 6 8)))

( n1r5c8   n1r2c7   n1r3c6   n4r6c6   n4r3c9   n4r1c4   n8r4c7
  n9r2c6   n9r6c1   n9r4c5   n1r8c2   n1r7c4   n4r8c7   n7r8c5
  n7r2c4   n9r1c9   n1r4c3   n7r6c9 )

intersections:
((((8 0) (1 5 2) (3 5 8)) ((8 0) (2 5 2) (3 5 8)) ((8 0) (3 5 2) (3 8)))
 (((6 0) (9 4 8) (3 5 6 8)) ((6 0) (9 5 8) (2 3 5 6)))
 (((6 0) (7 7 9) (2 3 6 7)) ((6 0) (9 7 9) (2 3)))
 (((6 0) (4 9 6) (2 3 5 6)) ((6 0) (5 9 6) (2 3 5 6)))
 (((5 0) (1 5 2) (3 5 8)) ((5 0) (2 5 2) (3 5 8)))
 (((3 0) (1 5 2) (3 5 8)) ((3 0) (2 5 2) (3 5 8)) ((3 0) (3 5 2) (3 8)))
 (((2 0) (6 7 6) (2 3)) ((2 0) (6 8 6) (2 3 5)))
 (((2 0) (5 5 5) (2 6)) ((2 0) (5 6 5) (2 3 5 8)))
 ( n5r1c5   n3r4c2   n3r2c8   n8r2c5   n5r2c2   n8r1c8   n3r1c3
   n3r9c4   n5r7c3   n3r7c1   n6r5c9   n2r5c5   n5r5c1   n5r4c9
   n6r4c4   n5r9c6   n6r9c5   n3r8c9   n3r5c6   n9r3c3   n9r7c2
   n8r5c4   n7r3c2   n7r5c3   n6r2c3   n5r6c4   n5r8c8   n4r5c2
   n4r9c3   n3r6c7   n2r1c2   n2r7c6   n2r6c8   n2r9c7   n6r3c8
   n3r3c5   n9r9c8   n8r3c1   n8r9c2   n8r8c6   n7r7c8   n7r1c7
   n6r7c7   n6r8c1   n2r4c1   n2r2c9 ))

1 2 3   4 5 6   7 8 9
4 5 6   7 8 9   1 3 2
8 7 9   2 3 1   5 6 4
2 3 1   6 9 7   8 4 5
5 4 7   8 2 3   9 1 6
9 6 8   5 1 4   3 2 7
3 9 5   1 4 2   6 7 8
6 1 2   9 7 8   4 5 3
7 8 4   3 6 5   2 9 1

it is in 3-template and can be solved with two combinations:
Hidden Text: Show
Code: Select all
#VT: (6 82 6698 8 720 102 92 68 60)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(29) (29 38) nil (40 42) nil nil (44 45) nil (8 17 26)

1       235789  3579    34578   35789   6       23478   2378    23479           
4       235789  35679   13578   35789   13589   123678  123678  23679           
3689    3789    3679    2       3789    13489   5       13678   34679           
2359    359     1359    3568    235689  7       12368   4       2356             
235     13457   13457   3568    23568   2358    9       123568  2356             
2359    6       8       345     1       23459   237     2357    2357             
3569    1359    13569   13567   4       1235    2367    235679  8               
3568    13458   2       9       35678   1358    3467    3567    34567           
7       34589   34569   3568    23568   2358    2346    23569   1               


1: (1 4 7)
#VT: (1 82 6698 2 720 102 10 68 60)
Cells: (16 24 30 44 58 65) nil nil (4 27 51 70) nil nil (13 68) nil nil
SetVC: ( n4r1c4   n7r2c4   n1r2c7   n1r3c6   n4r3c9   n1r4c3
         n1r5c8   n4r6c6   n1r7c4   n1r8c2   n7r8c5   n4r8c7
         n8r4c7   n9r2c6   n9r6c1   n9r4c5   n9r1c9   n7r6c9 )

#VT: (1 82 6698 2 720 102 6 14 4)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil (41 77) nil

1       23578   357     4       358     6       237     2378    9               
4       2358    356     7       358     9       1       2368    236             
368     3789    3679    2       38      1       5       3678    4               
235     35      1       356     9       7       8       4       2356             
235     3457    3457    3568    2356    2358    9       1       2356             
9       6       8       35      1       4       23      235     7               
356     359     3569    1       4       235     2367    235679  8               
3568    1       2       9       7       358     4       356     356             
7       34589   34569   3568    2356    2358    236     23569   1               


2: (1 6 8)
#VT: (1 82 6698 2 720 26 6 14 4)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil (18 62 71 72 80) nil nil nil
EraseCC: ( n6r8c1   n8r8c6   n8r9c2   n8r3c1   n3r3c5   n4r9c3
           n4r5c2   n6r7c7   n7r1c7   n7r7c8   n7r5c3   n8r5c4
           n9r9c8   n6r3c8   n9r3c3   n7r3c2   n2r9c7   n2r7c6
           n3r6c7   n6r2c3   n9r7c2   n5r6c4   n2r6c8   n3r5c6
           n5r9c6   n6r4c4   n5r4c9   n2r5c5   n6r5c9   n3r8c9
           n3r9c4   n6r9c5   n2r2c9   n3r4c2   n5r5c1   n3r7c1
           n5r7c3   n5r8c8   n3r1c3   n8r1c8   n5r2c2   n8r2c5
           n3r2c8   n2r4c1   n2r1c2   n5r1c5 )
1 2 3   4 5 6   7 8 9
4 5 6   7 8 9   1 3 2
8 7 9   2 3 1   5 6 4
2 3 1   6 9 7   8 4 5
5 4 7   8 2 3   9 1 6
9 6 8   5 1 4   3 2 7
3 9 5   1 4 2   6 7 8
6 1 2   9 7 8   4 5 3
7 8 4   3 6 5   2 9 1
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby coloin » Fri Dec 09, 2022 6:30 pm

Code: Select all
.8.........4..2.3.....5........4.2....31...8..6..........6...4..7...3...2..7..5.. ED=7.3/7.1/7.1  18C

this 18C might be an improvement
surely to be at all meaningful basics has to be applied first
coloin
 
Posts: 2382
Joined: 05 May 2005
Location: Devon

Re: Pattern Overlay Method

Postby P.O. » Fri Dec 09, 2022 7:37 pm

the template procedure starts like this: the puzzle is loaded into its data structure, i.e. the clues are put into their cells and all empty cells are filled with candidates from 1 to 9, then the elimination of the candidates linked to the clues is made, then a scan for singles is done because at the start a single candidate in a unit or a cell is just one more clue, and if necessary the grid is updated, then the templates are calculated: it is the numbers that are reported.

but i understand that there may be other ways to do it.

so with this procedure here is the count for this puzzle:
Code: Select all
.8.........4..2.3.....5........4.2....31...8..6..........6...4..7...3...2..7..5..
#VT: (866 9 7 12 58 88 119 156 4845)  = 4845 mnvt
#VC:(1 3 3 3 2 2 2 2 0)               = 18 clues
#CC:(48 18 18 19 31 32 36 33 63)      = 298 candidates
P.O.
 
Posts: 1376
Joined: 07 June 2021

Re: Pattern Overlay Method

Postby Mathimagics » Tue Dec 13, 2022 10:07 am

I have an issue with these 2 puzzles:

Code: Select all
.....1..2..3....4..5..6.........2.3..7....8..6..4........3..5....2.7....1.......6  TC3? Perfect 18
1....6...4...........2..5.......7.4.......9...68.1........4...8..29.....7.......1  TC3? 17c, MNVT = 6698


In both cases you said these were in TC3 (3-template), but I found that TC4 is needed.

For "Perfect 18", in your log, you have:

Code: Select all
2
#VT: (33 4 4 45 53 5 53 571 4569)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil
2 3
#VT: (5 4 4 25 30 4 29 282 1615)
Cells: (21 29) nil nil nil nil nil nil nil nil
SetVC: ( n1r3c3   n1r4c2 )


My #VT counts agree with the first, but not with the second. As far as I can tell, the inference (r3c3 = r4c2 = 1) does not become available until we test 4-template combinations.

My TC3-template test at this point:

Code: Select all
TC2 = {  33,   4,   4,  45,  53,   5,  53, 571,4569}
TC3 = {  33,   4,   4,  45,  53,   5,  53, 571,1615}


My solver agrees with yours for the other TC3/TC4 cases that I could find to compare it with ...
User avatar
Mathimagics
2017 Supporter
 
Posts: 1926
Joined: 27 May 2015
Location: Canberra

Re: Pattern Overlay Method

Postby P.O. » Tue Dec 13, 2022 4:37 pm

hi Mathimagics, i am glad you take interest in solving sudokus with templates, comparing our results can be informative.

my analysis for the 17 clues mnvt 6698: i find it is in fact solvable with one combination of 3: (1 4 7)

as i mentioned elsewhere i start by forming the combinations of two by intersecting the templates for one value with all the others: (1 2) (1 3) ... (2 3) ... (7 9).
then all the combinations are formed by combining the previous ones: the 3 from the 2, the 4 from the 3 etc.
so for doing the combination (1 4 7), (1 4) (1 7) and (4 7) are done first and some templates can be eliminated already, all those that dont figure in any of these 3 combinations, then the combination (1 4 7) is formed from them and here what i find:
Hidden Text: Show
Code: Select all
1....6...4...........2..5.......7.4.......9...68.1........4...8..29.....7.......1

initialization:

#VT: (6 82 6698 8 720 102 92 68 60)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(29) (29 38) nil (40 42) nil nil (44 45) nil (8 17 26)

1       235789  3579    34578   35789   6       23478   2378    23479           
4       235789  35679   13578   35789   13589   123678  123678  23679           
3689    3789    3679    2       3789    13489   5       13678   34679           
2359    359     1359    3568    235689  7       12368   4       2356             
235     13457   13457   3568    23568   2358    9       123568  2356             
2359    6       8       345     1       23459   237     2357    2357             
3569    1359    13569   13567   4       1235    2367    235679  8               
3568    13458   2       9       35678   1358    3467    3567    34567           
7       34589   34569   3568    23568   2358    2346    23569   1               


1: (1 4 7) 10 compatible instances:

1..4....74..7..1....7..1..4..1..7.4..74....1.....14.7....14.7...1..7.4..74......1
1..4....74..7..1....7..1..4..1..7.4..74....1.....147.....14..7..1..7.4..74......1
1..4...7.4..7..1....7..1..4..1..7.4..74....1.....14..7...14.7...1..7.4..74......1
1..4..7..4..7..1....7..1..4..1..7.4..74....1.....14..7...14..7..1..7.4..74......1
1.74.....4..7..1.......1.74..1..7.4..74....1.....14..7...14.7...1..7.4..74......1
1..4....74..7..1...7...1..4..1..7.4..47....1.....14.7....14.7...1..7.4..7.4.....1
1..4....74..7..1...7...1..4..1..7.4..47....1.....147.....14..7..1..7.4..7.4.....1
1..4...7.4..7..1...7...1..4..1..7.4..47....1.....14..7...14.7...1..7.4..7.4.....1
1..4..7..4..7..1...7...1..4..1..7.4..47....1.....14..7...14..7..1..7.4..7.4.....1
17.4.....4..7..1.......1.74..1..7.4..47....1.....14..7...14.7...1..7.4..7.4.....1

leave these templates:

1..............1.......1.....1.............1.....1.......1......1...............1

...4.....4................4.......4...4...........4.......4..........4...4.......
...4.....4................4.......4..4............4.......4..........4....4......

........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........
......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........
.......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........
.7..........7............7......7.....7..............7......7......7....7........


whose analysis updates the grid to its solution:


#VT: (1 82 6698 2 720 102 10 68 60)
Cells: (16 24 30 44 58 65) nil nil (4 27 51 70) nil nil (13 68) nil nil
SetVC: ( n4r1c4   n7r2c4   n1r2c7   n1r3c6   n4r3c9   n1r4c3
         n1r5c8   n4r6c6   n1r7c4   n1r8c2   n7r8c5   n4r8c7
         n8r4c7   n9r2c6   n9r6c1   n9r4c5   n9r1c9   n7r6c9 )

#VT: (1 6 434 2 84 6 6 14 4)
Cells: nil (2 18 28) nil nil nil (61 64) nil nil nil
SetVC: ( n2r1c2   n2r2c9   n2r4c1   n6r7c7   n6r8c1   n7r1c7
         n7r7c8   n8r8c6   n8r9c2   n8r3c1   n9r9c8   n3r3c5
         n6r3c8   n2r9c7   n2r6c8   n2r7c6   n3r6c7   n4r9c3
         n4r5c2   n5r8c8   n5r6c4   n6r2c3   n7r5c3   n7r3c2
         n8r5c4   n9r7c2   n9r3c3   n3r5c6   n3r8c9   n5r9c6
         n6r4c4   n5r4c9   n5r5c1   n2r5c5   n6r5c9   n3r7c1
         n5r7c3   n3r9c4   n6r9c5   n3r1c3   n8r1c8   n5r2c2
         n8r2c5   n3r2c8   n3r4c2   n5r1c5 )
1 2 3   4 5 6   7 8 9
4 5 6   7 8 9   1 3 2
8 7 9   2 3 1   5 6 4
2 3 1   6 9 7   8 4 5
5 4 7   8 2 3   9 1 6
9 6 8   5 1 4   3 2 7
3 9 5   1 4 2   6 7 8
6 1 2   9 7 8   4 5 3
7 8 4   3 6 5   2 9 1

the puzzle perfect 18 is more complicated as it needs three runs of the combinations of three to be solved, but solving it by directly forming the combinations of 3 i found the two combinations that justify the setting of n1r3c3 and n1r4c2:
Hidden Text: Show
Code: Select all
.....1..2..3....4..5..6.........2.3..7....8..6..4........3..5....2.7....1.......6

initialization:

#VT: (56 5 5 64 59 6 70 677 5894)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil (14 76) (41) nil nil nil nil nil nil

4789    4689    46789   5789    34589   1       3679    56789   2               
2789    12689   3       25789   589     5789    1679    4       15789           
24789   5       14789   2789    6       34789   1379    1789    13789           
4589    1489    14589   156789  1589    2       14679   3       14579           
23459   7       1459    1569    159     3569    8       12569   1459             
6       12389   1589    4       13589   35789   1279    12579   1579             
4789    4689    46789   3       12489   4689    5       12789   14789           
34589   34689   2       15689   7       45689   1349    189     13489           
1       3489    45789   589     24589   4589    23479   2789    6               


1: (1 2 3) 95 compatible instances:

.....13.2..32....12.1..3....1...2.3.3...1..2..2..3.1.....32..1...21....313....2..
....31..2..32....12.1.....3.1...2.3.3...1..2..2...31.....32..1...21..3..13....2..
....31..2..32....12.1...3...1...2.3.3...1..2..2...31.....32..1...21....313....2..
.....13.22.3.....1..12.3....1...2.3.3...1..2..2..3.1.....32..1...21....313....2..
....31..22.3.....1..12....3.1...2.3.3...1..2..2...31.....32..1...21..3..13....2..
....31..22.3.....1..12..3...1...2.3.3...1..2..2...31.....32..1...21....313....2..
....31..2.23.....1..12....3.1...2.3.2..1.3....3....21....31..2.3.2...1..1...2.3..
....31..2..32..1..2.1.....3.1...2.3.3......21.2..13......32..1...21..3..13....2..
....31..2..32..1..2.1...3...1...2.3.3......21.2..13......32..1...21....313....2..
....31..2.23...1....12....3.1...2.3.2....3..1.3..1.2.....32..1.3.21.....1.....32.
....31..22.3...1....12....3.1...2.3.3......21.2..13......32..1...21..3..13....2..
....31..22.3...1....12..3...1...2.3.3......21.2..13......32..1...21....313....2..
....31..2.23...1....12....3.1...2.3.2....3.1..3..1.2.....3...213.21.....1...2.3..
....31..2.23...1....12....3.1...2.3.2....3.1..3..1.2.....32...13.21.....1.....32.
.....13.2..32..1..2.1..3....1...2.3.3...1..2..2..3...1...32..1...21....313....2..
....31..2..32..1..2.1.....3.1...2.3.3...1..2..2...3..1...32..1...21..3..13....2..
....31..2..32..1..2.1...3...1...2.3.3...1..2..2...3..1...32..1...21....313....2..
....31..2.23...1....12....3.1...2.3.2...13....3....2.1...32..1.3.21.....1.....32.
.....13.22.3...1....12.3....1...2.3.3...1..2..2..3...1...32..1...21....313....2..
....31..22.3...1....12....3.1...2.3.3...1..2..2...3..1...32..1...21..3..13....2..
....31..22.3...1....12..3...1...2.3.3...1..2..2...3..1...32..1...21....313....2..
.....13.2..32..1..2.1..3....1...2.3.3...1..2..2..3..1....32...1..21....313....2..
....31..2..32..1..2.1.....3.1...2.3.3...1..2..2...3.1....32...1..21..3..13....2..
....31..2..32..1..2.1...3...1...2.3.3...1..2..2...3.1....32...1..21....313....2..
....31..2.23...1....12....3.1...2.3.2...13....3....21....3...213.21.....1...2.3..
....31..2.23...1....12....3.1...2.3.2...13....3....21....32...13.21.....1.....32.
.....13.22.3...1....12.3....1...2.3.3...1..2..2..3..1....32...1..21....313....2..
....31..22.3...1....12....3.1...2.3.3...1..2..2...3.1....32...1..21..3..13....2..
....31..22.3...1....12..3...1...2.3.3...1..2..2...3.1....32...1..21....313....2..
....31..2.23...1....12....3.1...2.3.2..1.3....3....2.1...31..2.3.2....1.1...2.3..
....31..2.23...1....12....3.1...2.3.2..1.3....3....21....31..2.3.2.....11...2.3..
.....13.2.132.....2....3..1.....213.3...1..2..21.3.......32..1...21....313....2..
....31..2.132.....2.....3.1.....213.3...1..2..21..3......32..1...21....313....2..
.....13.2213.........2.3..1.....213.3...1..2..21.3.......32..1...21....313....2..
....31..2213.........2..3.1.....213.3...1..2..21..3......32..1...21....313....2..
....31..2.132.....2.....3.1.....213.3.1....2..2..13......32..1...21....313....2..
....31..2213.........2..3.1.....213.3.1....2..2..13......32..1...21....313....2..
.....13.2.132.....2....3..1....12.3.3.1....2..2..3.1.....32..1...21....313....2..
....31..2.132.....2.....3.1....12.3.3.1....2..2...31.....32..1...21....313....2..
.....13.2213.........2.3..1....12.3.3.1....2..2..3.1.....32..1...21....313....2..
....31..2213.........2..3.1....12.3.3.1....2..2...31.....32..1...21....313....2..
.....13.2.132.....2....3..1..1..2.3.3...1..2..2..3.1.....32..1...21....313....2..
....31..2.132.....2.....3.1..1..2.3.3...1..2..2...31.....32..1...21....313....2..
.....13.2213.........2.3..1..1..2.3.3...1..2..2..3.1.....32..1...21....313....2..
....31..2213.........2..3.1..1..2.3.3...1..2..2...31.....32..1...21....313....2..
.....13.2.132.....2....3.1......213.3...1..2..21.3.......32...1..21....313....2..
....31..2.132.....2......13.....213.3...1..2..21..3......32...1..21..3..13....2..
....31..2.132.....2.....31......213.3...1..2..21..3......32...1..21....313....2..
.....13.2213.........2.3.1......213.3...1..2..21.3.......32...1..21....313....2..
....31..2213.........2...13.....213.3...1..2..21..3......32...1..21..3..13....2..
....31..2213.........2..31......213.3...1..2..21..3......32...1..21....313....2..
....31..2.132.....2......13.....213.3.1....2..2..13......32...1..21..3..13....2..
....31..2.132.....2.....31......213.3.1....2..2..13......32...1..21....313....2..
....31..2213.........2...13.....213.3.1....2..2..13......32...1..21..3..13....2..
....31..2213.........2..31......213.3.1....2..2..13......32...1..21....313....2..
.....13.2.132.....2....3.1.....12.3.3.1....2..2..3.1.....32...1..21....313....2..
....31..2.132.....2......13....12.3.3.1....2..2...31.....32...1..21..3..13....2..
....31..2.132.....2.....31.....12.3.3.1....2..2...31.....32...1..21....313....2..
.....13.2213.........2.3.1.....12.3.3.1....2..2..3.1.....32...1..21....313....2..
....31..2213.........2...13....12.3.3.1....2..2...31.....32...1..21..3..13....2..
....31..2213.........2..31.....12.3.3.1....2..2...31.....32...1..21....313....2..
.....13.2.132.....2....3.1...1..2.3.3...1..2..2..3.1.....32...1..21....313....2..
....31..2.132.....2......13..1..2.3.3...1..2..2...31.....32...1..21..3..13....2..
....31..2.132.....2.....31...1..2.3.3...1..2..2...31.....32...1..21....313....2..
.....13.2213.........2.3.1...1..2.3.3...1..2..2..3.1.....32...1..21....313....2..
....31..2213.........2...13..1..2.3.3...1..2..2...31.....32...1..21..3..13....2..
....31..2213.........2..31...1..2.3.3...1..2..2...31.....32...1..21....313....2..
.....13.2.132.....2....31.......2.313...1..2..21.3.......32..1...21....313....2..
....31..2.132.....2.....1.3.....2.313...1..2..21..3......32..1...21..3..13....2..
.....13.2213.........2.31.......2.313...1..2..21.3.......32..1...21....313....2..
....31..2213.........2..1.3.....2.313...1..2..21..3......32..1...21..3..13....2..
.....13.2.132.....2....31......12.3.3......21.21.3.......32..1...21....313....2..
....31..2.132.....2.....1.3....12.3.3......21.21..3......32..1...21..3..13....2..
.....13.2213.........2.31......12.3.3......21.21.3.......32..1...21....313....2..
....31..2213.........2..1.3....12.3.3......21.21..3......32..1...21..3..13....2..
....31..2.132.....2.....1.3.....2.313.1....2..2..13......32..1...21..3..13....2..
....31..2213.........2..1.3.....2.313.1....2..2..13......32..1...21..3..13....2..
.....13.2.132.....2....31......12.3.3.1....2..2..3...1...32..1...21....313....2..
....31..2.132.....2.....1.3....12.3.3.1....2..2...3..1...32..1...21..3..13....2..
.....13.2213.........2.31......12.3.3.1....2..2..3...1...32..1...21....313....2..
....31..2213.........2..1.3....12.3.3.1....2..2...3..1...32..1...21..3..13....2..
.....13.2.132.....2....31......12.3.3.1....2..2..3..1....32...1..21....313....2..
....31..2.132.....2.....1.3....12.3.3.1....2..2...3.1....32...1..21..3..13....2..
.....13.2213.........2.31......12.3.3.1....2..2..3..1....32...1..21....313....2..
....31..2213.........2..1.3....12.3.3.1....2..2...3.1....32...1..21..3..13....2..
....31..2.132.....2.....1.3..1..2.3.3......21.2..13......32..1...21..3..13....2..
....31..2213.........2..1.3..1..2.3.3......21.2..13......32..1...21..3..13....2..
.....13.2.132.....2....31....1..2.3.3...1..2..2..3...1...32..1...21....313....2..
....31..2.132.....2.....1.3..1..2.3.3...1..2..2...3..1...32..1...21..3..13....2..
.....13.2213.........2.31....1..2.3.3...1..2..2..3...1...32..1...21....313....2..
....31..2213.........2..1.3..1..2.3.3...1..2..2...3..1...32..1...21..3..13....2..
.....13.2.132.....2....31....1..2.3.3...1..2..2..3..1....32...1..21....313....2..
....31..2.132.....2.....1.3..1..2.3.3...1..2..2...3.1....32...1..21..3..13....2..
.....13.2213.........2.31....1..2.3.3...1..2..2..3..1....32...1..21....313....2..
....31..2213.........2..1.3..1..2.3.3...1..2..2...3.1....32...1..21..3..13....2..


leave these templates:

.....1...........1..1.......1...........1..........1.........1....1.....1........
.....1...........1..1.......1..........1............1.....1..........1..1........
.....1.........1....1.......1...............1....1...........1....1.....1........
.....1.........1....1.......1..............1.....1............1...1.....1........
.....1.........1....1.......1...........1............1.......1....1.....1........
.....1.........1....1.......1...........1...........1.........1...1.....1........
.....1.........1....1.......1..........1.............1....1...........1.1........
.....1.........1....1.......1..........1............1.....1............11........
.....1....1...............1......1......1......1.............1....1.....1........
.....1....1...............1......1....1..........1...........1....1.....1........
.....1....1...............1....1......1............1.........1....1.....1........
.....1....1...............1..1..........1..........1.........1....1.....1........
.....1....1..............1.......1......1......1..............1...1.....1........
.....1....1..............1.......1....1..........1............1...1.....1........
.....1....1..............1.....1......1............1..........1...1.....1........
.....1....1..............1...1..........1..........1..........1...1.....1........
.....1....1.............1..........1....1......1.............1....1.....1........
.....1....1.............1......1............1..1.............1....1.....1........
.....1....1.............1..........1..1..........1...........1....1.....1........
.....1....1.............1......1......1..............1.......1....1.....1........
.....1....1.............1......1......1.............1.........1...1.....1........
.....1....1.............1....1..............1....1...........1....1.....1........
.....1....1.............1....1..........1............1.......1....1.....1........
.....1....1.............1....1..........1...........1.........1...1.....1........

........2...2.....2.............2..........2..2...........2......2............2..
........2.2..........2..........2...2..............2.........2...2..........2....
........2.2..........2..........2...2..............2......2......2.............2.
........22...........2..........2..........2..2...........2......2............2..

......3....3...........3..........3.3............3.......3.............3.3.......
....3......3..............3.......3......3....3..........3.....3..............3..
....3......3..............3.......3.3.............3......3...........3...3.......
....3......3............3.........3.3.............3......3.............3.3.......


their analysis eliminated: n1r4c4 n1r6c2 n2r6c8 n3r8c2


#VT: (24 4 4 64 59 6 70 677 5894)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:(31 47) (53) (65) nil nil nil nil nil nil

4789   4689   46789  5789   34589  1      3679   56789  2               
2789   12689  3      25789  589    5789   1679   4      15789           
24789  5      14789  2789   6      34789  1379   1789   13789           
4589   1489   14589  56789  1589   2      14679  3      14579           
23459  7      1459   1569   159    3569   8      12569  1459           
6      2389   1589   4      13589  35789  1279   1579   1579           
4789   4689   46789  3      12489  4689   5      12789  14789           
34589  4689   2      15689  7      45689  1349   189    13489           
1      3489   45789  589    24589  4589   23479  2789   6               



2: (1 2 6) 11 compatible instances:


.....1.62.6.2....12.1.6.....1...26.....61..2.62....1....6.2..1...21.6...1.....2.6
.....1.6226......1..126.....1...26.....61..2.62....1....6.2..1...21.6...1.....2.6
..6..1..2.2....6.1..126.....1.6.2...2..1...6.6.....21.....16.2..62...1..1...2...6
..6..1..2.2....6.1..126.....1.6.2...2..1...6.6.....21..6..1..2...2..61..1...2...6
.6...1..2.2....6.1..126.....1.6.2...2..1...6.6.....21...6.1..2...2..61..1...2...6
.....1.62.6.2..1..2.1.6.....1...26.....6...2162..1......6.2..1...21.6...1.....2.6
.....1.6226....1....126.....1...26.....6...2162..1......6.2..1...21.6...1.....2.6
.....1.62.6.2..1..2.1.6.....1...26.....61..2.62......1..6.2..1...21.6...1.....2.6
.....1.6226....1....126.....1...26.....61..2.62......1..6.2..1...21.6...1.....2.6
.....1.62.6.2..1..2.1.6.....1...26.....61..2.62.....1...6.2...1..21.6...1.....2.6
.....1.6226....1....126.....1...26.....61..2.62.....1...6.2...1..21.6...1.....2.6


leave these templates:

.....1...........1..1.......1...........1..........1.........1....1.....1........
.....1...........1..1.......1..........1............1.....1..........1..1........
.....1.........1....1.......1...............1....1...........1....1.....1........
.....1.........1....1.......1...........1............1.......1....1.....1........
.....1.........1....1.......1...........1...........1.........1...1.....1........

........2...2.....2.............2..........2..2...........2......2............2..
........2.2..........2..........2...2..............2.........2...2..........2....
........22...........2..........2..........2..2...........2......2............2..

.......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


their analysis set n1r3c3 and n1r4c2


#VT: (5 3 4 64 59 4 70 677 5894)
Cells: (21 29) nil nil nil nil nil nil nil nil
SetVC: ( n1r3c3   n1r4c2 )

#VT: (9 5 5 42 59 6 64 514 4507)
Cells: nil nil nil nil nil nil nil nil nil
Candidates:nil nil nil nil nil nil nil nil nil

4789   4689   46789  5789   34589  1      3679   56789  2               
2789   2689   3      25789  589    5789   1679   4      15789           
24789  5      1      2789   6      34789  379    789    3789           
4589   1      4589   56789  589    2      4679   3      4579           
23459  7      459    1569   159    3569   8      12569  1459           
6      2389   589    4      13589  35789  1279   1579   1579           
4789   4689   46789  3      12489  4689   5      12789  14789           
34589  4689   2      15689  7      45689  1349   189    13489           
1      3489   45789  589    24589  4589   23479  2789   6       
P.O.
 
Posts: 1376
Joined: 07 June 2021

Next

Return to Advanced solving techniques