Whip exampleFlashback on the whips, with an illustrative example which was still missing. I've now finished replacing nrczt- chains and lassos by nrczt-whips in SudoRules.
I've chosen this example because it displays the 4 kinds of whips: rc, rn, cn and bn.
This example is grid "282 hard" from the Sudoku-factory forum.
In the full nrc-notation, the dot at the place of the last rlc indicates that no rlc is possible.
- Code: Select all
+-------+-------+-------+
| 1 . . | . . . | 2 . . |
| . . . | . . . | 3 . 4 |
| . 4 . | 5 . 6 | . . . |
+-------+-------+-------+
| . 7 . | . . 8 | . 4 . |
| . . 8 | . 4 . | 1 . . |
| . 9 . | 2 . . | . 6 . |
+-------+-------+-------+
| . . . | 1 . 7 | . 8 . |
| 5 . 7 | . . . | . . . |
| . . 3 | . . . | . . 9 |
+-------+-------+-------+
***** SudoRules version 13.7w *****
1.....2........3.4.4.5.6....7...8.4...8.4.1...9.2...6....1.7.8.5.7........3.....9
hidden-single-in-a-block ==> r1c9 = 6
interaction row r8 with block b8 for number 9 ==> r7c5 <> 9
interaction block b3 with row r3 for number 8 ==> r3c5 <> 8, r3c1 <> 8, r9c8 <> 5, r5c8 <> 5
nrc-chain[3] n3{r8c8 r5c8} - n3{r5c2 r1c2} - n3{r3c1 r3c5} ==> r8c5 <> 3
nrc-chain[3] n3{r7c9 r7c5} - n3{r3c5 r3c1} - n3{r1c2 r5c2} ==> r5c9 <> 3
nrc-chain[3] n3{r7c5 r7c9} - n3{r8c8 r5c8} - n3{r5c2 r1c2} ==> r1c5 <> 3
nrc-chain[3] n3{r5c8 r8c8} - n3{r7c9 r7c5} - n3{r3c5 r3c1} ==> r5c1 <> 3
nrct-chain[3] n7{r2c1 r3c1} - n3{r3c1 r3c5} - n2{r3c5 r3c3} ==> r2c1 <> 2
At this point, the PM is:
- Code: Select all
+-------------------+-------------------+-------------------+
| 1 358 59 | 34789 789 349 | 2 579 6 |
| 6789 2568 2569 | 789 12789 129 | 3 1579 4 |
| 2379 4 29 | 5 12379 6 | 789 179 178 |
+-------------------+-------------------+-------------------+
| 236 7 1256 | 369 13569 8 | 59 4 235 |
| 26 2356 8 | 3679 4 359 | 1 2379 257 |
| 34 9 145 | 2 1357 135 | 578 6 3578 |
+-------------------+-------------------+-------------------+
| 2469 26 2469 | 1 2356 7 | 456 8 235 |
| 5 1268 7 | 34689 2689 2349 | 46 123 123 |
| 2468 1268 3 | 468 2568 245 | 4567 127 9 |
+-------------------+-------------------+-------------------+
and we get our first whip
nrczt-whip-cn[3] n3{r5c2 r1c2} - n3{r1c4 r8c4} - {n3r8c8 .} ==> r5c6 <> 3
in full nrc-notation:
nrczt-whip-cn[3] n3{r5 r1}c2 - n3{r1 r8 r4* r5*}c4 - n3{r8 . r5*}c8 ==> r5c6 <> 3
This is a very special whip, making no use of t-candidates. We could name it an nrcz-whip (nrcz-whips are not programmed independently in SudoRules).
The suffix cn in its name indicates that the final contradiction will be obtained in a cn-cell, which will be the cn-cell of the last, isolated left-linking candidate, here c8n3. And indeed, in this cn-cell, n3 appears only in rows r8 and r5: r8 is impossible (left-linking candidate) and r5 is impossible (nrc-linked to the target). Repeated in this particular case, the proof of the general theorem goes like this: if the target was true, in column c8, there'd be no place for number n3; therefore the target is false. But of course, we never have to re-do this proof.
nrct-chain[3] {n9 n5}r1c3 - n5{r6c3 r5c2} - {n5 n9}r5c6 ==> r1c6 <> 9
nrc-chain[4] n3{r3c5 r3c1} - n3{r1c2 r5c2} - n3{r5c8 r8c8} - n3{r7c9 r7c5} ==> r6c5 <> 3, r4c5 <> 3
nrc-chain[4] n3{r7c9 r7c5} - n3{r3c5 r3c1} - n3{r1c2 r5c2} - n3{r5c8 r8c8} ==> r8c9 <> 3
nrct-chain[3] {n1 n2}r8c9 - n2{r4c9 r5c8} - n3{r5c8 r8c8} ==> r8c8 <> 1
nrct-chain[5] {n2 n9}r3c3 - {n9 n5}r1c3 - n5{r6c3 r5c2} - n3{r5c2 r1c2} - n3{r3c1 r3c5} ==> r3c5 <> 2
interaction row r3 with block b1 for number 2 ==> r2c3 <> 2, r2c2 <> 2
nrct-chain[5] n2{r3c3 r3c1} - {n2 n6}r5c1 - {n6 n3}r4c1 - {n3 n4}r6c1 - n4{r9c1 r7c3} ==> r7c3 <> 2
At this point, the PM is:
- Code: Select all
+-------------------+-------------------+-------------------+
| 1 358 59 | 34789 789 34 | 2 579 6 |
| 6789 568 569 | 789 12789 129 | 3 1579 4 |
| 2379 4 29 | 5 1379 6 | 789 179 178 |
+-------------------+-------------------+-------------------+
| 236 7 1256 | 369 1569 8 | 59 4 235 |
| 26 2356 8 | 3679 4 59 | 1 2379 257 |
| 34 9 145 | 2 157 135 | 578 6 3578 |
+-------------------+-------------------+-------------------+
| 2469 26 469 | 1 2356 7 | 456 8 235 |
| 5 1268 7 | 34689 2689 2349 | 46 23 12 |
| 2468 1268 3 | 468 2568 245 | 4567 127 9 |
+-------------------+-------------------+-------------------+
and we get our next two whips (still cn-whips), the two of which use both t- and z- candidates:
nrczt-whip-cn[5] n9r7{c1 c3} - {n9 n5}r1c3 - {n5 n6}r2c3 - n6{r4c3 r5c2} - {n5r5c2 .} ==> r7c1 <> 6
in full nrc-notation:
nrczt-whip-cn[5] n9{r7c1 r7c3} - {n9 n5}r1c3 - {n5 n6 n9#n9r7c3}r2c3 - n6{r4c3 r5c2 r4c1*} - n5{r5 . r1#n5r1c3 r2#n5r1c3}c2 ==> r7c1 <> 6
nrczt-whip-cn[5] n2{r2c5 r2c6} - n1{r2c6 r6c6} - n1{r4c5 r3c5} - n3{r3c5 r3c1} - {n7r3c1 .} ==> r2c5 <> 7
in full nrc-notation:
nrczt-whip-cn[5] n2r2{c5 c6} - n1{r2 r6}c6 - n1{r4 r3 r2* r5#n1r6c6}c5 - n3r3{c5 c1} - n7{r3 . r2*}c1 ==> r2c5 <> 7
Now comes an rn-whip:
nrczt-whip-rn[5] n2{r9c2 r5c2} - n3{r5c2 r1c2} - n5{r1c2 r2c2} - {n5 n9}r1c3 - {n9r7c3 .} ==> r7c1 <> 2
in full nrc-notation:
nrczt-whip-rn[5] n2{r9 r5 r7* r8*}c2 - n3{r5 r1}c2 - n5{r1 r2 r5#n2r5c2}c2 - {n5 n9}r1c3 - n9r7{c3 . c1*} ==> r7c1 <> 2
the first cell has two z-candidates (a rare situation).
nrct-chain[5] n1{r9c2 r9c8} - {n1 n2}r8c9 - {n2 n3}r8c8 - n3{r8c6 r7c5} - n2{r7c5 r7c2} ==> r9c2 <> 2
At this point, the PM is:
- Code: Select all
+-------------------+-------------------+-------------------+
| 1 358 59 | 34789 789 34 | 2 579 6 |
| 6789 568 569 | 789 1289 129 | 3 1579 4 |
| 2379 4 29 | 5 1379 6 | 789 179 178 |
+-------------------+-------------------+-------------------+
| 236 7 1256 | 369 1569 8 | 59 4 235 |
| 26 2356 8 | 3679 4 59 | 1 2379 257 |
| 34 9 145 | 2 157 135 | 578 6 3578 |
+-------------------+-------------------+-------------------+
| 49 26 469 | 1 2356 7 | 456 8 235 |
| 5 1268 7 | 34689 2689 2349 | 46 23 12 |
| 2468 168 3 | 468 2568 245 | 4567 127 9 |
+-------------------+-------------------+-------------------+
and we get our first rc-whip:
nrczt-whip-rc[5] {n6 n2}r5c1 - {n2 n3}r4c1 - {n3 n9}r4c4 - {n9 n5}r5c6 - {n5r5c2 .} ==> r4c3 <> 6
in full nrc-notation:
nrczt-whip-rc[5] {n6 n2}r5c1 - {n2 n3 n6*}r4c1 - {n3 n9 n6*}r4c4 - {n9 n5}r5c6 - {n5 . n2#n2r5c1 n3#n3r4c1 n6*}r5c2 ==> r4c3 <> 6
The end works similarly:
nrct-chain[4] n6{r2c3 r7c3} - n9{r7c3 r7c1} - n4{r7c1 r9c1} - n8{r9c1 r2c1} ==> r2c1 <> 6
nrczt-whip-rn[5] n7{r5c4 r6c5} - n7{r1c5 r1c4} - n4{r1c4 r1c6} - n3{r1c6 r1c2} - {n3r5c2 .} ==> r5c8 <> 7
nrct-chain[6] n7{r2c1 r3c1} - n3{r3c1 r1c2} - n3{r5c2 r5c8} - {n3 n2}r8c8 - {n2 n1}r8c9 - {n1 n7}r9c8 ==> r2c8 <> 7
nrct-chain[6] n8{r9c1 r2c1} - n7{r2c1 r3c1} - n7{r3c9 r1c8} - n5{r1c8 r2c8} - {n5 n6}r2c2 - {n6 n2}r7c2 ==> r9c1 <> 2
interaction block b7 with column c2 for number 2 ==> r5c2 <> 2
nrc-chain[3] n2{r7c2 r8c2} - {n2 n3}r8c8 - n3{r7c9 r7c5} ==> r7c5 <> 2
nrct-chain[6] n8{r9c1 r2c1} - n7{r2c1 r3c1} - n7{r3c9 r1c8} - n5{r1c8 r2c8} - {n5 n6}r2c2 - n6{r2c3 r7c3} ==> r9c1 <> 6
interaction column c1 with block b4 for number 6 ==> r5c2 <> 6
nrc-chain[6] {n8 n4}r9c1 - {n4 n3}r6c1 - n3{r5c2 r5c8} - {n3 n2}r8c8 - {n2 n1}r8c9 - n1{r9c8 r9c2} ==> r9c2 <> 8
nrczt-whip-bn[6] n3{r3c1 r1c2} - n3{r5c2 r5c8} - {n3 n2}r8c8 - {n2 n1}r8c9 - {n1 n7}r9c8 - n7r3c8 - ==> r3c1 <> 7
hidden-singles ==> r2c1 = 7, r9c1 = 8
interaction block b7 with row r7 for number 4 ==> r7c7 <> 4
hidden-pairs-in-a-row {n4 n9}r7{c1 c3} ==> r7c3 <> 6
hidden-single-in-a-column ==> r2c3 = 6
xy-chain[3] {n9 n5}r1c3 - {n5 n8}r2c2 - {n8 n9}r2c4 ==> r1c5 <> 9, r1c4 <> 9
nrc-chain[3] {n9 n8}r2c4 - {n8 n7}r1c5 - n7{r6c5 r5c4} ==> r5c4 <> 9
nrczt-whip-rn[5] n3{r8c8 r5c8} - {n3 n5}r5c2 - {n5 n9}r5c6 - n9{r8c6 r8c5} - {n8r8c5 .} ==> r8c4 <> 3
nrc-chain[2] n3{r5c2 r1c2} - n3{r1c4 r4c4} ==> r4c1 <> 3
naked-pairs-in-a-block {n2 n6}{r4c1 r5c1} ==> r4c3 <> 2
hidden-single-in-a-column ==> r3c3 = 2
nrczt-whip-cn[5] n3{r4c4 r6c6} - n1{r6c6 r2c6} - n2{r2c6 r2c5} - n9{r2c5 r3c5} - {n9r3c7 .} ==> r4c4 <> 9
nrczt-whip-bn[5] n8{r8c4 r8c5} - n9{r8c5 r8c6} - n3{r8c6 r7c5} - n6{r7c5 r4c5} - {n9r4c5 .} ==> r8c4 <> 6
nrczt-whip-rn[5] {n4 n6}r9c4 - n6{r4c4 r4c5} - n9{r4c5 r5c6} - n9{r8c6 r8c5} - {n8r8c5 .} ==> r8c4 <> 4
naked-pairs-in-a-column {n8 n9}{r2 r8}c4 ==> r1c4 <> 8
nrct-chain[6] n1{r8c9 r3c9} - n8{r3c9 r6c9} - n7{r6c9 r5c9} - {n7 n6}r5c4 - {n6 n2}r5c1 - n2{r4c1 r4c9} ==> r8c9 <> 2
naked and hidden singles ==> r8c9 = 1, r9c2 = 1
nrct-chain[3] n8{r6c7 r3c7} - {n8 n7}r3c9 - n7{r6c9 r6c7} ==> r6c7 <> 5
nrct-chain[6] n9{r5c6 r4c5} - {n9 n5}r4c7 - {n5 n6}r7c7 - n6{r7c2 r8c2} - n6{r8c5 r9c5} - n5{r9c5 r9c6} ==> r5c6 <> 5
naked and hidden singles ==> r5c6 = 9, r4c7 = 9
interaction column c7 with block b9 for number 5 ==> r7c9 <> 5
naked-pairs-in-a-block {n2 n3}{r7c9 r8c8} ==> r9c8 <> 2
naked-single ==> r9c8 = 7
interaction row r1 with block b2 for number 7 ==> r3c5 <> 7
interaction row r9 with block b8 for number 2 ==> r8c6 <> 2,> r8c5 <> 2
naked-pairs-in-a-column {n3 n4}{r1 r8}c6 ==> r9c6 <> 4, r6c6 <> 3
hidden-single-in-a-block ==> r4c4 = 3
naked-pairs-in-a-row {n5 n9}r1{c3 c8} ==> r1c2 <> 5
hidden-pairs-in-a-block {n8 n9}{r8c4 r8c5} ==> r8c5 <> 6
xy-chain[3] {n5 n2}r4c9 - {n2 n3}r5c8 - {n3 n5}r5c2 ==> r5c9 <> 5
hidden-single-in-a-row ==> r5c2 = 5
naked-singles
GRID 0 SOLVED. LEVEL = L6, MOST COMPLEX RULE = NRCZT6
135784296
786912354
942536718
671358942
258649137
394271865
429167583
567893421
813425679
10/03/08: changed the nrc-notation for the end of whips, so as to make it closer to that of chains: - {nrc .} instead of - nrc -