a more concrete illustration of resolution by templates.
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
then examining the Complementary Sets two observations can be made, some Candidate Cells are in all sets, some Candidate Cells are not in any of the sets, in the first case the value can be set in those cells in the second case it can be eliminated
for this puzzle it is enough to get the solution.
- Code: Select all
Initialization:
#VT: (12 5 16 5 128 4 3 12 4)
1 2 3 4 578 58 9 6 578
4 56 9 56 3578 1 358 3578 2
7 8 56 569 2 3569 135 345 1345
2 4569 456 3 589 5689 7 1 4568
35 1456 8 1256 15 7 235 345 9
359 7 156 12569 4 25689 2358 358 3568
8 1459 145 7 1359 3459 6 2 135
6 15 1257 8 135 235 4 9 1357
59 3 12457 1259 6 2459 158 578 1578
Value: 3
Value Cells: (3 31 74)
Candidate Cells: (14 16 17 24 25 26 27 37 43 44 46 52 53 54 59 60 63 68 69 72)
Complementary Sets:
(17 24 43 46 63 68)
(17 24 43 46 59 72)
(17 24 37 52 63 68)
(17 24 37 52 59 72)
(16 24 44 46 63 68)
(16 24 44 46 59 72)
(16 24 37 53 63 68)
(16 24 37 53 59 72)
(14 26 43 46 63 69)
(14 26 43 46 60 72)
(14 26 37 52 63 69)
(14 26 37 52 60 72)
(14 25 44 46 63 69)
(14 25 44 46 60 72)
(14 25 37 53 63 69)
(14 25 37 53 60 72)
Candidate 3 to be eliminated in cells: (27 54)
Value: 5
Value Cells: 0
Candidate Cells: (5 6 9 11 13 14 16 17 21 22 24 25 26 27 29 30 32 33 36 37 38
40 41 43 44 46 48 49 51 52 53 54 56 57 59 60 63 65 66 68 69
72 73 75 76 78 79 80 81)
Complementary Sets:
(9 13 21 33 44 46 59 65 79)
(9 13 21 33 44 46 56 68 79)
(9 13 21 33 43 46 59 65 80)
(9 13 21 33 43 46 56 68 80)
(9 13 21 32 44 46 60 65 79)
(9 13 21 32 44 46 56 69 79)
(9 13 21 32 43 46 60 65 80)
(9 13 21 32 43 46 56 69 80)
(9 13 21 33 37 53 59 65 79)
(9 13 21 33 37 53 56 68 79)
(9 13 21 33 37 52 59 65 80)
(9 13 21 33 37 52 56 68 80)
(9 13 21 32 37 53 60 65 79)
(9 13 21 32 37 53 56 69 79)
(9 13 21 32 37 52 60 65 80)
(9 13 21 32 37 52 56 69 80)
(6 17 21 36 40 46 59 65 79)
(6 17 21 36 40 46 56 68 79)
(6 17 21 32 43 46 63 65 76)
(6 17 21 32 43 46 56 72 76)
(6 17 21 36 37 49 59 65 79)
(6 17 21 36 37 49 56 68 79)
(6 17 21 32 37 52 63 65 76)
(6 17 21 32 37 52 56 72 76)
(6 17 21 29 43 49 63 68 73)
(6 17 21 29 43 49 59 72 73)
(6 17 21 29 40 52 63 68 73)
(6 17 21 29 40 52 59 72 73)
(6 16 21 36 40 46 59 65 80)
(6 16 21 36 40 46 56 68 80)
(6 16 21 32 44 46 63 65 76)
(6 16 21 32 44 46 56 72 76)
(6 16 21 36 37 49 59 65 80)
(6 16 21 36 37 49 56 68 80)
(6 16 21 32 37 53 63 65 76)
(6 16 21 32 37 53 56 72 76)
(6 16 21 29 44 49 63 68 73)
(6 16 21 29 44 49 59 72 73)
(6 16 21 29 40 53 63 68 73)
(6 16 21 29 40 53 59 72 73)
(5 17 21 36 40 46 60 65 79)
(5 17 21 36 40 46 56 69 79)
(5 17 21 33 43 46 63 65 76)
(5 17 21 33 43 46 56 72 76)
(5 17 21 36 37 49 60 65 79)
(5 17 21 36 37 49 56 69 79)
(5 17 21 33 37 52 63 65 76)
(5 17 21 33 37 52 56 72 76)
(5 17 21 29 43 49 63 69 73)
(5 17 21 29 43 49 60 72 73)
(5 17 21 29 40 52 63 69 73)
(5 17 21 29 40 52 60 72 73)
(5 16 21 36 40 46 60 65 80)
(5 16 21 36 40 46 56 69 80)
(5 16 21 33 44 46 63 65 76)
(5 16 21 33 44 46 56 72 76)
(5 16 21 36 37 49 60 65 80)
(5 16 21 36 37 49 56 69 80)
(5 16 21 33 37 53 63 65 76)
(5 16 21 33 37 53 56 72 76)
(5 16 21 29 44 49 63 69 73)
(5 16 21 29 44 49 60 72 73)
(5 16 21 29 40 53 63 69 73)
(5 16 21 29 40 53 60 72 73)
(9 11 22 33 44 46 59 66 79)
(9 11 22 33 44 46 57 68 79)
(9 11 22 33 43 46 59 66 80)
(9 11 22 33 43 46 57 68 80)
(9 11 22 32 44 46 60 66 79)
(9 11 22 32 44 46 57 69 79)
(9 11 22 32 43 46 60 66 80)
(9 11 22 32 43 46 57 69 80)
(9 11 22 33 37 53 59 66 79)
(9 11 22 33 37 53 57 68 79)
(9 11 22 33 37 52 59 66 80)
(9 11 22 33 37 52 57 68 80)
(9 11 22 32 37 53 60 66 79)
(9 11 22 32 37 53 57 69 79)
(9 11 22 32 37 52 60 66 80)
(9 11 22 32 37 52 57 69 80)
(6 11 26 36 40 46 59 66 79)
(6 11 26 36 40 46 57 68 79)
(6 11 26 32 43 46 63 66 76)
(6 11 26 32 43 46 57 72 76)
(6 11 26 36 37 49 59 66 79)
(6 11 26 36 37 49 57 68 79)
(6 11 26 32 37 52 63 66 76)
(6 11 26 32 37 52 57 72 76)
(6 11 26 30 43 49 63 68 73)
(6 11 26 30 43 49 59 72 73)
(6 11 26 30 40 52 63 68 73)
(6 11 26 30 40 52 59 72 73)
(6 11 25 36 40 46 59 66 80)
(6 11 25 36 40 46 57 68 80)
(6 11 25 32 44 46 63 66 76)
(6 11 25 32 44 46 57 72 76)
(6 11 25 36 37 49 59 66 80)
(6 11 25 36 37 49 57 68 80)
(6 11 25 32 37 53 63 66 76)
(6 11 25 32 37 53 57 72 76)
(6 11 25 30 44 49 63 68 73)
(6 11 25 30 44 49 59 72 73)
(6 11 25 30 40 53 63 68 73)
(6 11 25 30 40 53 59 72 73)
(5 11 26 36 40 46 60 66 79)
(5 11 26 36 40 46 57 69 79)
(5 11 26 33 43 46 63 66 76)
(5 11 26 33 43 46 57 72 76)
(5 11 26 36 37 49 60 66 79)
(5 11 26 36 37 49 57 69 79)
(5 11 26 33 37 52 63 66 76)
(5 11 26 33 37 52 57 72 76)
(5 11 26 30 43 49 63 69 73)
(5 11 26 30 43 49 60 72 73)
(5 11 26 30 40 52 63 69 73)
(5 11 26 30 40 52 60 72 73)
(5 11 25 36 40 46 60 66 80)
(5 11 25 36 40 46 57 69 80)
(5 11 25 33 44 46 63 66 76)
(5 11 25 33 44 46 57 72 76)
(5 11 25 36 37 49 60 66 80)
(5 11 25 36 37 49 57 69 80)
(5 11 25 33 37 53 63 66 76)
(5 11 25 33 37 53 57 72 76)
(5 11 25 30 44 49 63 69 73)
(5 11 25 30 44 49 60 72 73)
(5 11 25 30 40 53 63 69 73)
(5 11 25 30 40 53 60 72 73)
Candidate 5 to be eliminated in cells: (14 24 27 38 41 48 51 54 75 78 81)
Value: 6
Value Cells: (8 61 64 77)
Candidate Cells: (11 13 21 22 24 29 30 33 36 38 40 48 49 51 54)
Complementary Sets:
(13 21 36 38 51)
(13 21 33 38 54)
(11 24 36 40 48)
(11 24 30 40 54)
Candidate 6 to be eliminated in cells: (22 29 49)
Value: 9
Value Cells: (7 12 45 71)
Candidate Cells: (22 24 29 32 33 46 49 51 56 59 60 73 76 78)
Complementary Sets:
(24 32 46 56 76)
(24 29 49 59 73)
(22 32 46 56 78)
(22 29 51 59 73)
Candidate 9 to be eliminated in cells: (33 60)