hi
R. Jamilthere are certainly several ways to use templates as a resolution technique, personally i use the following method:
with the combinations of 2, to be kept
a template for 1 must figure in all these combinations: (1 2) (1 3) (1 4) (1 5) (1 6) (1 7) (1 8) (1 9)
a template for 2 must figure in all these combinations: (1 2) (2 3) (2 4) (2 5) (2 6) (2 7) (2 8) (2 9)
a template for 3 must figure in all these combinations: (1 3) (2 3) (3 4) (3 5) (3 6) (3 7) (3 8) (3 9)
a template for 4 must figure in all these combinations: (1 4) (2 4) (3 4) (4 5) (4 6) (4 7) (4 8) (4 9)
a template for 5 must figure in all these combinations: (1 5) (2 5) (3 5) (4 5) (5 6) (5 7) (5 8) (5 9)
a template for 6 must figure in all these combinations: (1 6) (2 6) (3 6) (4 6) (5 6) (6 7) (6 8) (6 9)
a template for 7 must figure in all these combinations: (1 7) (2 7) (3 7) (4 7) (5 7) (6 7) (7 8) (7 9)
a template for 8 must figure in all these combinations: (1 8) (2 8) (3 8) (4 8) (5 8) (6 8) (7 8) (8 9)
a template for 9 must figure in all these combinations: (1 9) (2 9) (3 9) (4 9) (5 9) (6 9) (7 9) (8 9)
with the combinations of 3, to be kept
a template for 1 must figure in all these combinations:
(1 2 3) (1 2 4) (1 2 5) (1 2 6) (1 2 7) (1 2 8) (1 2 9) (1 3 4) (1 3 5)
(1 3 6) (1 3 7) (1 3 8) (1 3 9) (1 4 5) (1 4 6) (1 4 7) (1 4 8) (1 4 9)
(1 5 6) (1 5 7) (1 5 8) (1 5 9) (1 6 7) (1 6 8) (1 6 9) (1 7 8) (1 7 9)
(1 8 9)
a template for 2 must figure in all these combinations:
(1 2 3) (1 2 4) (1 2 5) (1 2 6) (1 2 7) (1 2 8) (1 2 9) (2 3 4) (2 3 5)
(2 3 6) (2 3 7) (2 3 8) (2 3 9) (2 4 5) (2 4 6) (2 4 7) (2 4 8) (2 4 9)
(2 5 6) (2 5 7) (2 5 8) (2 5 9) (2 6 7) (2 6 8) (2 6 9) (2 7 8) (2 7 9)
(2 8 9)
a template for 3 must figure in all these combinations:
(1 2 3) (1 3 4) (1 3 5) (1 3 6) (1 3 7) (1 3 8) (1 3 9) (2 3 4) (2 3 5)
(2 3 6) (2 3 7) (2 3 8) (2 3 9) (3 4 5) (3 4 6) (3 4 7) (3 4 8) (3 4 9)
(3 5 6) (3 5 7) (3 5 8) (3 5 9) (3 6 7) (3 6 8) (3 6 9) (3 7 8) (3 7 9)
(3 8 9)
etc.
with the combinations of 4, to be kept
a template for 1 must figure in all these combinations:
(1 2 3 4) (1 2 3 5) (1 2 3 6) (1 2 3 7) (1 2 3 8) (1 2 3 9) (1 2 4 5)
(1 2 4 6) (1 2 4 7) (1 2 4 8) (1 2 4 9) (1 2 5 6) (1 2 5 7) (1 2 5 8)
(1 2 5 9) (1 2 6 7) (1 2 6 8) (1 2 6 9) (1 2 7 8) (1 2 7 9) (1 2 8 9)
(1 3 4 5) (1 3 4 6) (1 3 4 7) (1 3 4 8) (1 3 4 9) (1 3 5 6) (1 3 5 7)
(1 3 5 8) (1 3 5 9) (1 3 6 7) (1 3 6 8) (1 3 6 9) (1 3 7 8) (1 3 7 9)
(1 3 8 9) (1 4 5 6) (1 4 5 7) (1 4 5 8) (1 4 5 9) (1 4 6 7) (1 4 6 8)
(1 4 6 9) (1 4 7 8) (1 4 7 9) (1 4 8 9) (1 5 6 7) (1 5 6 8) (1 5 6 9)
(1 5 7 8) (1 5 7 9) (1 5 8 9) (1 6 7 8) (1 6 7 9) (1 6 8 9) (1 7 8 9)
a template for 2 must figure in all these combinations:
(1 2 3 4) (1 2 3 5) (1 2 3 6) (1 2 3 7) (1 2 3 8) (1 2 3 9) (1 2 4 5)
(1 2 4 6) (1 2 4 7) (1 2 4 8) (1 2 4 9) (1 2 5 6) (1 2 5 7) (1 2 5 8)
(1 2 5 9) (1 2 6 7) (1 2 6 8) (1 2 6 9) (1 2 7 8) (1 2 7 9) (1 2 8 9)
(2 3 4 5) (2 3 4 6) (2 3 4 7) (2 3 4 8) (2 3 4 9) (2 3 5 6) (2 3 5 7)
(2 3 5 8) (2 3 5 9) (2 3 6 7) (2 3 6 8) (2 3 6 9) (2 3 7 8) (2 3 7 9)
(2 3 8 9) (2 4 5 6) (2 4 5 7) (2 4 5 8) (2 4 5 9) (2 4 6 7) (2 4 6 8)
(2 4 6 9) (2 4 7 8) (2 4 7 9) (2 4 8 9) (2 5 6 7) (2 5 6 8) (2 5 6 9)
(2 5 7 8) (2 5 7 9) (2 5 8 9) (2 6 7 8) (2 6 7 9) (2 6 8 9) (2 7 8 9)
etc.
etc.
with this method if the puzzle has multiple solutions all its solutions are obtained
if the puzzle has no solution this is noted when there is no more template for certain combinations
for example this puzzle is invalid, with my implementation it passes the combinations of 2 then is found invalid with the combinations of 3
- Code: Select all
. 6 . 2 . . . . .
. . 3 . 9 . . . .
. 4 . 6 . 1 . . .
1 . . . 5 . 2 . .
4 . 7 . 3 . . 1 .
2 . . . 4 . . . 5
. 1 8 7 . . . 3 .
. . . . 1 . 8 . .
. . . . . 9 . . .
.6.2.......3.9.....4.6.1...1...5.2..4.7.3..1.2...4...5.187...3.....1.8.......9...
5789 6 1 2 78 3 4579 45789 4789
578 278 3 458 9 4578 14567 245678 124678
5789 4 259 6 78 1 3579 25789 23789
1 389 69 89 5 678 2 46789 346789
4 5 7 89 3 2 69 1 689
2 389 69 1 4 678 3679 6789 5
569 1 8 7 26 456 4569 3 2469
35679 2379 24569 345 1 456 8 245679 24679
3567 237 2456 3458 268 9 14567 24567 12467
196 candidates.
PM VALID.
#VT: (2 10 4 15 23 24 78 20 48)
Cells: nil nil nil nil nil nil nil nil nil
Candidates: nil nil (65 74) (16 17 18) (10 16 17) (35 36 52 53 60 66 69 75) (15) (11 18) nil
5789 6 1 2 78 3 4579 45789 4789
78 27 3 458 9 458 167 2678 1267
5789 4 259 6 78 1 3579 25789 23789
1 389 69 89 5 678 2 4789 34789
4 5 7 89 3 2 69 1 689
2 389 69 1 4 678 379 789 5
569 1 8 7 26 45 4569 3 2469
35679 279 2459 345 1 45 8 245679 24679
3567 27 245 3458 268 9 14567 24567 12467
177 candidates.
PM VALID.
2combs
#VT: (2 10 4 15 23 20 78 19 46)
Cells: nil nil nil nil nil nil nil nil nil
Candidates: nil nil nil nil nil (61) nil nil nil
5789 6 1 2 78 3 4579 45789 4789
78 27 3 458 9 458 167 2678 1267
5789 4 259 6 78 1 3579 25789 23789
1 389 69 89 5 678 2 4789 34789
4 5 7 89 3 2 69 1 689
2 389 69 1 4 678 379 789 5
569 1 8 7 26 45 459 3 2469
35679 279 2459 345 1 45 8 245679 24679
3567 27 245 3458 268 9 14567 24567 12467
176 candidates.
PM VALID.
3combs
Puzzle invalid: .6.2.......3.9.....4.6.1...1...5.2..4.7.3..1.2...4...5.187...3.....1.8.......9...
#VT: (2 9 4 12 14 8 76 0 13)