a bit late for me to chime in but i shall anyway
considering Mini Row & Mini Cols as restraint subsets with in a row
you'd need 2 checks per row and can skip the entire third row/col. per band/stack
now the interesting part is you can completely ignore the entirety of the 3 stack
- Code: Select all
Bands
ABC | DEF | ... <- first 2 mini row sectors prove the 3rd is true
DEF | ABC | ... <- first 2 mini row sectors prove the 3rd is true
... | ... | ... <- thus the 3rd row is also in full
- Code: Select all
Stacks
---------------------------
AD. | ... | ... <- first 2 mini Col sectors prove the 3rd is true
BE. | ... | ... <- first 2 mini Col sectors prove the 3rd is true
CF. | ... | ... <- thus the 3rd Col is also in full
---------------------------
DA. | ... | ...
EB. | ... | ...
FC. | ... | ...
---------------------------
... | ... | ...
... | ... | ...
... | ... | ...
the fun part
Mini Row of box 1 + Mini Row of Box 1 also proves 3rd mini row of box 1 is true
+
mini Col of box 1 + Mini Col of box 1 also proves 3rd Col of box 1 is true.
in other words the unmarked cell can only be 1 digit for the box when no digits are copied/duplicated.
--------
which is equal to 45 - [ mini Row + Mini row ] + [ mini Col + Mini Col ] - [ ( Mini row * Min Col )+ (mini Row * Mini Col) ] = last number missing. ie set of [ 1-> 9 digit only]
--------------------------------------------------------------------
which means the only Real boxes we have to check are Boxes 3,6,7,8,9
once boxes 3,6,7,8 are confirmed the only valid positing of the digits can be only arranged one way in box 9
[6 {Rows} + 6{Cols} + 5{Boxes} * 9 {digits } ] + 81{Cells} = 270 pseudo constraints.
once boxes 3,6,7,8 are confirmed the only valid positing of the digits can be only arranged one way in box 9
[6 {Rows} + 6{Cols} + 4{Boxes} * 9 {digits } ] + 81{Cells} = 225 pseudo constraints.
- Code: Select all
+--------------+--------------+-----------+
| 12 12 1 | 12 12 1 | 23 23 3 |
| 12 12 1 | 12 12 1 | 23 23 3 |
| 2 2 . | 2 2 . | 23 23 3 |
+--------------+--------------+-----------+
| 12 12 1 | 12 12 1 | 23 23 3 |
| 12 12 1 | 12 12 1 | 23 23 3 |
| 2 2 . | 2 2 . | 23 23 3 |
+--------------+--------------+-----------+
| 123 123 13 | 123 123 13 | 2 2 . |
| 123 123 13 | 123 123 13 | 2 2 . |
| 23 23 3 | 23 23 . | . . . |
+--------------+--------------+-----------+
1 = Row
2= Col
3= box
--------------------------------------------- tricks for mini row summations: ---------------------------------------------------------------------
- Code: Select all
{shortened list}
3 # used sum total
9 8 7 24
9 8 6 23
9 8 5 22
9 8 4 21
9 8 3 20
9 8 2 19
9 8 1 18
8 7 6 21
8 7 5 20
8 7 4 19
8 7 3 18
8 7 2 17
8 7 1 16
7 6 5 18
7 6 4 17
7 6 3 16
7 6 2 15
7 6 1 14
6 5 4 15
6 5 3 14
6 5 2 13
6 5 1 12
5 4 3 12
5 4 2 11
5 4 1 10
4 3 2 9
4 3 1 8
3 2 1 6
first rule:
2 mini sectors are using Set-wise Multiplication to prove they do not carry identical numbers,
2nd Rule : that a mini sector must be valid set's sum total can only be found on this list else they are invalid.
rule 3: 45 - ( A + B) = C : were C must also fall in the chart above.
notes: some numbers summations total over lap however every single one of those that do involves 1 over lapping digit with the exception of "12" { thus rule 1 invalidates a lot of errors, rule 2 insures sum totals can only fall on the chart with out overlapping digits. and rule three insures all three are the sum of 45.
with some cleaver code you can check 2 rows, 2 cols and 2 box at the same time.
to cover all the rows/cols/box you'd need ~
3 checks each with 3 math checks per min part. => 3 * (6*2*3) = 108 checks.... {when physically looking at the operations needed}
but it is done in 3 steps for the whole grid and all digits.
the list of 3 digits and their sum can be further reduced if you'd like:
to a list of 3 sets of 3 digits that properly form a sum of 45 with out overlapping digits.
which is:
84 choices for the first spot,
20 for the 2nd
1 for the third.
Additional notes
2 rows 4 mini rows OF 2 BOXES cannot contain any identical missing digits else THE THIRD box has duplicate numbers
- Code: Select all
Row 1 min row (a+ b) - [1..9]
*
row 2 mini row (a+b) - [1..9]
= [empty]
- Code: Select all
123 | 786 | .9.
456 | 123 |.9.
... | ... | ... <- box 3 must have the digit 9 placed twice
And the opposite side of that:
They cannot share more then 3 digits else 3 cells contain more then 3 placements ie Row 3 mini row C = more then 3 digits.
- Code: Select all
Row 1 min row (a+ b) - [1..9]
*
row 2 mini row (a+b) - [1..9]
<=[3 digits shared]
- Code: Select all
123 | 786 | ...
456 | 123 |...
... | ... | 1236 <- must equal 4 digits
the box mini rows of two intersecting rows cannot share missing digits else the box row 3 = duplicates
Row 1 mini Row a + Row 2 mini row A - [1..9]
*
Row 1 mini Row b + Row 2 mini row B - [ 1..9]
= [ empty]
- Code: Select all
123 | 678 | ...
456 | 123 |...
.9. | .9. | ... <- must equal 9 digit twice