Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

Chained APE

 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
Overkill

Joined: 24 Jan 2007
Posts: 2
:
Location: Darmstadt, Germany

Items
PostPosted: Thu Feb 01, 2007 8:59 am    Post subject: Chained APE Reply with quote

Hello!

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:

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)!
Back to top
View user's profile Send private message
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Thu Feb 01, 2007 8:46 pm    Post subject: Reply with quote

Although I see the logic working in your technique, it may be too complicated for the human player. Your user name is well chosen. Smile

Here is an alternative view, using the same cells:

1. If r3c2<>3 => r2c2=3.
2. If r3c2=3 => (r2c2<>3) r3c7=4 => r3c5=9 => r2c6=4 => (r2c2<>4) r2c1=1 => r2c2<>1 : r2c2=9

Because 1. and 2. cover all cases, r2c2 is reduced to {3,9}

Personally, I prefer this method because it does not require the elaborate administration that APE variants need.

Please be aware that APE is closely related to ALS. Embedding ALS into chains is common practice for advanced solvers.

Ruud
_________________
Meet me at sudocue.net
Back to top
View user's profile Send private message Visit poster's website
Overkill

Joined: 24 Jan 2007
Posts: 2
:
Location: Darmstadt, Germany

Items
PostPosted: Fri Feb 02, 2007 12:41 pm    Post subject: Reply with quote

Thanks for Your reply. This reduction is *very* nice and short - but hasn't it a bit of trial and error to get there?
Question Or is there a way to tell in advance that to check "what if a is a candidate and what if its not" will result in an reduction of any cell. Was it an educated guess or is there some strategy i did not see yet.

btw.: I am currently implementing ALS-strategies and thought I've read that APE and ALS are closely related several times I can not see the relation. (ok, its a three letter strategy starting with A Wink - but there should be more)
maybe I should scan the forum for camparisons or start a new threat on that relationship...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron