Note: This has already been posted on Sudoku Programmers...
Implementing yet another sudoku app I implemented several strategies (i found and understood) for a solver/generator/help-system. Reading (E)APE I thought about combining the logic of XY Chains with APE.
Within a chain like AB-BC-CD I call A the unchained candidate of the first cell and D the unchained candidate of the last one. A better naming is welcome.
The logic of Chained APE (CAPE) is: If you can find a XY Chain that
- the first cell of the chain shares its "unchained" candidate A with X and
- the last cell shares its unchained candidate B with Y
then the combination A+B can be excluded for APE on X & Y.
If X would be A, the chain forces its last cell to be B and thus Y can not have Candidate B.
Obviously, the chain can be of odd or even length (different as in pure XY Chains) and the rules of APE and EAPE should be applied, also.
Using Chained APE I could solve #87 and #91 of the top 95 puzzles - see my test case dump:
- Code: Select all
example (#87 of top 95) ...5.3.......6.7..5.8....1636..2.......4.1.......3...567....2.8..4.7.......2..5..
using: Hidden Single, Single Candidate, Intersection Removal, Unique Rectangle, Naked Pair, X-Wing, Aligned Pair Exclusion, Y-Wing, Hidden Pair, Naked Triples, Sword Fish, Extended Aligned Pair Exclusion, Single Chain, XY-Chain, Hidden Triples, Naked Quads, Jelly Fish, WXYZ-Wing, Multivalue X-Wing, Multi Colouring, Squirm Bag, Hidden Quads
==>
+----------------+----------------+----------------+
| 7 49 6 | 5 1 3 | 48 489 2 |
| {14}[1349] 2 | 8 6 {49} | 7 5 349 |
| 5 [349] 8 | 7 {49} 2 | {34} 1 6 |
+----------------+----------------+----------------+
| 3 6 7 | 9 2 5 | 148 48 14 |
| 9 2 5 | 4 8 1 | 36 367 37 |
| 48 48 1 | 6 3 7 | 9 2 5 |
+----------------+----------------+----------------+
| 6 7 39 | 1 5 49 | 2 34 8 |
| 2 5 4 | 3 7 8 | 16 69 19 |
| 18 18 39 | 2 49 6 | 5 347 347 |
+----------------+----------------+----------------+
Chained Aligned Pair Exclusion
R2C2(1349) R3C2(349)
Initial Possible Combiantions (1+3 1+4 1+9 3+4 3+9 4+3 4+9 9+3 9+4)
R2C1(14)
-(1 4) Possible Combiantions (1+3 1+9 3+4 3+9 4+3 4+9 9+3 9+4)
R1C2(49)
-(4 9) Possible Combiantions (1+3 1+9 3+4 3+9 4+3 9+3)
R2C1(14) R1C2(49)
Extended Aligned Pair Exclusion Possible Combiantions (1+3 3+4 3+9 4+3 9+3)
R2C1(14) R2C6(49) R3C5(49) R3C7(34)
XY Chains 1-4-9-4-3 Possible Combiantions (3+4 3+9 4+3 9+3)
R2C2(1349)
Remove marks (1)
==>
+-------------+-------------+-------------+
| 7 49 6 | 5 1 3 | 48 489 2 |
| 14 349 2 | 8 6 49 | 7 5 349 |
| 5 349 8 | 7 49 2 | 34 1 6 |
+-------------+-------------+-------------+
| 3 6 7 | 9 2 5 | 148 48 14 |
| 9 2 5 | 4 8 1 | 36 367 37 |
| 48 48 1 | 6 3 7 | 9 2 5 |
+-------------+-------------+-------------+
| 6 7 39 | 1 5 49 | 2 34 8 |
| 2 5 4 | 3 7 8 | 16 69 19 |
| 18 18 39 | 2 49 6 | 5 347 347 |
+-------------+-------------+-------------+
thus the grid can be solved using the given strategies!
Free APE: when APE is not restricted to aligned cells, puzzles #29 #40 & #71 of top 95 can also be solved. But this strategy has a bit of a "trial and error" taste...
Chained APE seems logic to me and using a "does no wrong conclusions" testcase did not reveal any faults/bad reductions within the top95 and other puzzles.
My question is: is the Chained APE logic already covered by any other strategy or has some equal strategy been documented anwhere before?
If not, does anyone agree with my strategy?
Thank You for any comments (and forgive my bad english for I am German)!