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   

Forcing Chains implementation
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Sat Oct 29, 2005 6:58 pm    Post subject: Forcing Chains implementation Reply with quote

I implemented forcing chains in my solver, but I'm not sure I've covered all situations, so please tell me when I missed something.

1. For each cell with more than 1 candidate, for each of it's candidates, create a Forcing-Chain-Node that contains a list of all eliminations that would occur when that candidate were true. Add to this list the candidates for other cells that are forced to be true, either because one of the 2 candidates is eliminated (naked single), or because it is left as the last vacancy within a house (hidden single). I'm not sure whether this is called a 1-lookahead or a 2-lookahead list.

2. For each Forcing-Chain-Node created in step 1, append to it's effect list all the effects from the candidates it forces to be true. In this step it is possible to detect inconsistencies. When a candidate is set to true and false within an accumulated list, the candidate that owns the list can never be true, and can be eliminated. Two candidates for the same digit within a single house set to true is also an inconsistency.

3. For each cell with more than 1 candidate, compare the accumulated effect lists (created in step 2) of all it's candidates. When an effect appears in all lists, that effect (which could be either an elimination or a forced selection of a candidate) is always true and can be reported.

4. For each unbound digit within each house, compare the accumulated effect lists of all available cells for that digit. This is similar to step 3 and may also reveal "always true" effects.

With this technique added to my solver, I am now able to solve 72 of the Top95.

I could probably up this rate by improving step 2, combining eliminations from various paths, to make new forced selections, but I'm not sure if that would be allowed in 'formal' forcing chains. It would be very difficult to explain to the user. It could be an optional feature for a higher difficulty level.

I would like to know if I made a fundamental mistake, or missed anything, before I put this in my next release.

Thanks, Ruud
Back to top
View user's profile Send private message Visit poster's website
gaby

Joined: 02 Jul 2005
Posts: 120
:

Items
PostPosted: Sat Oct 29, 2005 8:22 pm    Post subject: Reply with quote

What I think you're looking at is more tabling, I was under the impression that forcing chains only followed chains of cells that have two candidates in, although you can start from any cell you like. Also, I find it's better to apply all the negative asssertions of a chain before looking for pinned squares.
_________________
Free daily sudoku - Online puzzle database
http://vanhegan.net/sudoku/
Back to top
View user's profile Send private message Visit poster's website
xyzzy

Joined: 24 Aug 2005
Posts: 80
:

Items
PostPosted: Sat Oct 29, 2005 8:22 pm    Post subject: Reply with quote

How is this any different than using the abhorrent "trial and error" with a breadth first search?

I seems to me, that the quest to find "logic" techniques to solve all sudokus is really a quest to find ways to disguise searching so that one can pretend it isn't being used.
Back to top
View user's profile Send private message Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Sat Oct 29, 2005 11:01 pm    Post subject: Reply with quote

gaby wrote:
What I think you're looking at is more tabling, I was under the impression that forcing chains only followed chains of cells that have two candidates in, although you can start from any cell you like.

I can always add this limitation, but the techniques are very similar, so I will use a single routine.

gaby also wrote:
I find it's better to apply all the negative assertions of a chain before looking for pinned squares.

True. That would make it complete, but requires a lot more 'searching and saving'. Currently, I'm perfecting the "accumulating effects" routine. That would produce a better yield for the complete chain.

xyzzy wrote:
How is this any different than using the abhorrent "trial and error" with a breadth first search?

Dunno. I do not fear T&E. Twisted Evil Actually, I use it frequently when solving sudokus by hand. Much quicker.

xyzzy also wrote:
I seems to me, that the quest to find "logic" techniques to solve all sudokus is really a quest to find ways to disguise searching so that one can pretend it isn't being used.

We've discussed this in other topics. Many of these techniques boil down to the question "What happens when I put this digit in that cell?". In testing this, some of these chains grow upto 20 in length before they produce a result. I would have given up long before that.

Since many solvers use it, I'd like to have my version, just to be able to say that I have it. It must work properly though, that's why I put this topic on the forum.

Ruud.
Back to top
View user's profile Send private message Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Sun Oct 30, 2005 7:02 am    Post subject: Reply with quote

I would just suggest that if you think in terms of linked strong chains, you can "gang" huge numbers of nodes together without ever having to consider them separately. Surely this is more efficient than going through every single node like that.

The Sudoku Assistant only solves 65/top95, and you are doing better than that, so I defer to your technique here. But consider that strong chains with weakly associated nodes greatly simplifies the analysis. When any one node of a strong chain is set TRUE, all are set. I suspect the top95 ones that you are solving that I'm not are due to my not testing EVERY node, just EVERY chain.

As for is this anything more than trial and error, or is this looking ahead, I really don't see how any of this is different from simple crosschecking. "A 3 must go here because if it didn't, it would have to go THERE, and then there would be two 3s in this column" is little different from "A 3 must go here because otherwise there would be a conflict over there." That's all forcing chains are doing, I think. And the reverse logic that Nick70 introduced, that equates to "multifurcating" is trickier, but still of the same nature -- "A 3 MUST go here because no matter what you put over HERE, that is the result you will get." The fact that this can be done "backward" in one straight, logical stream with simplel human marking and without the "bifurcation" seems proof enough to me that it is simple, direct logic.

No?







The Medusa chain analysis I'm using [/quote]
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Sun Oct 30, 2005 11:45 pm    Post subject: Reply with quote

I've spent some time on the Sudoku Players forum, and found lots of heated discussions on "pure logic" vs "guessing" vs "Trial & Error". Interestingly, Lummox JR made one of the best remarks there.

My free interpretation of it:

T&E is logic, because you use it to prove something. A guess is no more than just that. If you're lucky, it helps you on your way, but to call it logic, you must prove that the alternatives for that choice are not valid.

Encouraged by this, I have improved the merging routine, so all the cascading effects of an assumed candidate are taken into account.

The result: Now solving 90 of the Top95. Very Happy

I'm currently manually checking these last 5 puzzles to see what makes them so special.

Ruud
Back to top
View user's profile Send private message Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Mon Oct 31, 2005 7:35 pm    Post subject: Reply with quote

Short update:

Changed the way to find verities. Improved both score and performance.

The new score: 92 of the Top95 solved without backtracking.

Found out that puzzle #60 in Top95 is the famous "Toughest Known" in a slightly different minimal form, the other 2 toughies are #9 and #69.

A point of interest: #7 was in the list of 5, but now breaks with the improved verity search. The difference between #7 and #9 is a single pair of clues:
Code:
6.2.5.........3.4..........43...8....1....2........7..5..27...........81...6..... (#7)
6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6..... (#9)

Ruud.
Back to top
View user's profile Send private message Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Mon Oct 31, 2005 9:32 pm    Post subject: Reply with quote

funny you should mention that about "toughest known"

6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6.....

I've been hoping this would fall for a couple of days now.

Adding full chain/node reverse logic to Sudoku Assistant just took care of this one! Gosh, that's a powerful technique! Thank you Nick70!!!

http://www.stolaf.edu/people/hansonr/sudoku/?6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6.....

But, yes, this one is REALLY involved. Here are some highlights (in reverse solving order). Several of these are simple forcing chain issues, but some are more interesting.


Detail
Done! (35 steps)
OK! 682 153 479 951 764 832 374 892 165 437 528 916 816 947 253 295 316 748 568 271 394 729 435 681 143 689 527

Step 19 Strong Chains: 21
36 weak links
178 weak corners
r6c2 ISN'T 6: would leave no 7 in column 2 if Chain 6 has +(1) parity

(just forcing chains)

Step 17 Strong Chains: 21
39 weak links
164 weak corners
r2c7 ISN'T 6: would leave no 7 in column 2 if Chain 6 has +(0) parity
r3c5 ISN'T 6: would leave no 7 in column 2 if Chain 6 has +(0) parity

(more forcing chains)

Step 16 Strong Chains: 21
40 weak links
169 weak corners
r3c8 ISN'T 9: weak 0/0 corner between linked 1/1 strong chains 9 and 18

(a bit trickier, but still just a forcing issue)

Step 15 Strong Chains: 19
19 weak links
137 weak corners
r8c2 ISN'T 6: Reverse logic test: Node r8c2#6 must be FALSE

(OK! that step required the latest addition -- reverse logic applied to weak nodes)

Step 14 Strong Chains: 19
19 weak links
133 weak corners
r8c1 ISN'T 9: Reverse logic test: Node r8c1#9 must be FALSE

(here again)

Step 13 Strong Chains: 19
19 weak links
128 weak corners
r8c1 ISN'T 3: Reverse logic test: Node r8c1#3 must be FALSE

(and again!)

Step 12 Strong Chains: 19
19 weak links
131 weak corners
r3c3 ISN'T 7: weak 0/1 corner between linked 1/0 strong chains 8 and 9

(just another forcing chain)


Wow!!!
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Mon Oct 31, 2005 10:13 pm    Post subject: Reply with quote

Ruud, I think you and I are quickly converging on a common solution to top95.

Quote:


1. For each cell with more than 1 candidate, for each of it's candidates, create a Forcing-Chain-Node that contains a list of all eliminations that would occur when that candidate were true. Add to this list the candidates for other cells that are forced to be true, either because one of the 2 candidates is eliminated (naked single), or because it is left as the last vacancy within a house (hidden single). I'm not sure whether this is called a 1-lookahead or a 2-lookahead list.


What you define here are my "strong chains of a certain parity" (either 0 or 1, but specifcally the parity of your specific cell/candidate node). Althought I'm not certainl that is true in relation to "last vacancy wihtin a house" Say that again, please?

Quote:

2. For each Forcing-Chain-Node created in step 1, append to it's effect list all the effects from the candidates it forces to be true. In this step it is possible to detect inconsistencies. When a candidate is set to true and false within an accumulated list, the candidate that owns the list can never be true, and can be eliminated. Two candidates for the same digit within a single house set to true is also an inconsistency.

Again, we can replace "node" here with "chain" and do a whole lot at once. No need to ever do more than one check on any strong chain parity set. Right?


Quote:

3. For each cell with more than 1 candidate, compare the accumulated effect lists (created in step 2) of all it's candidates. When an effect appears in all lists, that effect (which could be either an elimination or a forced selection of a candidate) is always true and can be reported.


yes, this is what I would refer to as "forward-directed forced logic"

I think Nick70s is the reverse of this, right?

Quote:

4. For each unbound digit within each house, compare the accumulated effect lists of all available cells for that digit. This is similar to step 3 and may also reveal "always true" effects.


The only thing I'm not sure of is if you mean "true" to be "can be eliminated" or "true" to be "must be the value".
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Mon Oct 31, 2005 10:36 pm    Post subject: Reply with quote

Gaby wrote:
What I think you're looking at is more tabling

Looks like you're right. I checked the original topic by MadOverlord and it's basically the same technique.

Well, I get most of the fun of building my solver by thinking about strategies, so at least I had a good time figuring it out on my own. Wink

My latest improvements have brought it even closer to tabling. Got the verities done now, but still need to implement the "veracities" to crack the last 3 toughies.

I've also built a feature in the UI that can show an implication chain by coloring candidates. It has tought me that some of these chains could be expanded even further when you take line-box interactions and naked pairs into account. Probably other techniques too, but these 2 are very easy to spot.

So, to call it "Forcing Chains", I simply limit the implication tables to cells with just 2 candidates and leave out the negatives, is that it?

Ruud.
Back to top
View user's profile Send private message Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Mon Oct 31, 2005 11:28 pm    Post subject: Reply with quote

Guess what? I just stumbled on a bug in the weak-link code for Sudoku Assistant. When fixed, It's solving 9 of top95. Here's my "can't solve" list:

14.5....28..49..3..76.21....146..3..6....9..7.....36....1..4.5.46......3..71..2..

53..2.9...24.3..5...9...3.2....1.827...7...9.....981............564....9172.5.43.

..7..8.....6.2.3...3......9.1..5..6.....1.....7.9..1.27.......4.83..4...264...51.

5....9.4.9.2..45.1.7..5..9..83.97....4..6....69.1..8..32....1..85.9...6.....8..53

92.3....8..64.8.9.83.5........2...8.7.9..5.....2..6..4..8....1...1...4.22..7..8.9

Top95#60 is NOT among them, by the way. If what you mean by that is

... ... 94.
... .9. ..5
3.. ..5 .7.
.8. 4.. 1..
463 ... ...
... ..7 .8.
8.. 7.. ...
7.. ... .28
.5. 26. ...

more later....
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Tue Nov 01, 2005 1:08 am    Post subject: Reply with quote

Well Bob,
if we would be able to converge, we would solve the whole bunch. My 3 (even the former 5) unsolvables have no puzzle in common with yours.

To speed thing up a little, I've added to my tabling routine a check for "Magic Cells". When all cells are forced to a single digit in a node's implication tree, and we know that the puzzle has a single solution, the solver simply selects this candidate and leaves it to the basic functions (singles) to complete it.

This is what my solver does with your last 5:
Code:
14.5....28..49..3..76.21....146..3..6....9..7.....36....1..4.5.46......3..71..2..

This puzzle has, after basics and coloring had their go at it, a Magic Cell r4c1 digit 2.
Code:
53..2.9...24.3..5...9...3.2....1.827...7...9.....981............564....9172.5.43.

Another Magic Cell: r3c4 value 6.
Code:
..7..8.....6.2.3...3......9.1..5..6.....1.....7.9..1.27.......4.83..4...264...51.

2 inconsistent implication trees: r1c5 value 4, r6c5 value 3,
then knock-out by a Magic Cell r2c9 value 5.
Code:
5....9.4.9.2..45.1.7..5..9..83.97....4..6....69.1..8..32....1..85.9...6.....8..53

Basics, 2 coloring eliminations, and then r2c8 value 3 goes straight for the kill.
Code:
92.3....8..64.8.9.83.5........2...8.7.9..5.....2..6..4..8....1...1...4.22..7..8.9

The most interesting one. Basics, hidden pair, 5 coloring eliminations, inconsistent implication tree, a few basics, another inconsistent tree, another coloring elimination, which allows a uniqueness test that finally breaks it. Very nice example of various techniques working together Smile

The one you listed it indeed the Toughest Known. It has already been broken by MadOverlord's tabling and other techniques. This tells me my tabling implementation is not yet fully complete.

Quote:
last vacancy within a house

That should read: last vacancy (=unbound cell) for a digit within a house (=row,column,box)

Since I recognized that this technique is more like tabling, I'm more thinking in terms of implication trees than forcing chains, just like your Medusa technique spreads out like a tree. The code that builds the tree is a recursive function that adds one node to the tree in each iteration, and quickly bails out when either the tree contains inconsistencies, or when it is attempting to add an implication that it already contains.

Quote:
yes, this is what I would refer to as "forward-directed forced logic"

Sounds good to me. In my first attempt, I combined both forward and backward logic to join the nodes, but it turned out that it worked faster if I chose a single direction. I could have chosen backwards, like Nick, but this was a little faster, because I do not need links in 2 directions.

Quote:
The only thing I'm not sure of is if you mean "true" to be "can be eliminated" or "true" to be "must be the value".

What I mean is what I now know is called a "verity". When there are N possibilities for a cell, or value in a row, column or box, and the implication trees for all these N possibilities contain the same implication (either eliminate the same candidate, or force the same candidate to be true), then this implication is a truth for the puzzle itself. You cannot say anything about which of the N possibilities is the correct one, but you can assume that the common implication is true. It is a more general version of the XY-wing. In an XY-wing you have 2 possiblities, where both of them would eliminate one or more candidates. The candidates that are eliminated in both cases can therefore always be eliminated, no matter which way the XY-wing finally goes.

Ruud.
Back to top
View user's profile Send private message Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Tue Nov 01, 2005 4:55 am    Post subject: Reply with quote

Fascinating!

Well, I'm coming up to speed here fairly quickly, but I'm not quite there with all the lingo.

I'm delighted if Nick's strategy solves the "toughest known". Is that right? This one?

... ... 94.
... .9. ..5
3.. ..5 .7.
.8. 4.. 1..
463 ... ...
... ..7 .8.
8.. 7.. ...
7.. ... .28
.5. 26. ...

I have a hunch that the forward and reverse logic techniques are ALMOST but not QUITE the same. I had to ammend Nick's technique to be a bit more general in the reverse sense, and then I think I see how to solve his presented puzzle in a forward sense, but I'm out of energy now to implement a forward strategy in Sudoku Assistant. Maybe next week....

But here's the gist of it:

1) The reason the reverse technique is working is that it transends what people usually consider in terms of "forcing". Thus, instead of just considering that a node has to be true or not (BE or NOT BE eliminated), Nick considers the implications of "almost completed sets". This I think is the key, because in a reverse sense, what you do is suggest that a node is FALSE, and work back the implications via:

1. A will be TRUE if any of (a) are FALSE (strong chains here)
2. (a) will be FALSE if any one of B were to be TRUE (strong chains + weakly associated nodes)
3. B would be TRUE if any one of (b) were FALSE (strong chains again)
4. (b) would be FALSE if .....

BUT you can only go so far with that. The real breakthrough was in his seeing that there is an alternative method of (2). That is:

5. (a) will be FALSE in the case where there are N possibilities, and N-1 are already of the "If TRUE, then A is true" variety (from 3). In that special -- but not so rare with top95 -- case, we have:

[ ? A B C D ... ]

Here we can say that "A will be true (that is, ONE OF A, B, C, or D will be TRUE) iff ? is FALSE. So we assign FALSE to that node and continue. It's SO clever!

In addition, I submit that if we have:

[ a b .........]

then A is TRUE as well, because two values in a set cannot BOTH be "not false".

OK, so I SUSPECT that the same can be implemented in a forward fashion, and that is why you, too, are coming so close. I'll bet forward is NOT the same as backward, but the strategies are extremely similar:

1. If a is FALSE then all of B are TRUE (strong chains here)
2. If B is TRUE then all of b are FALSE (strong chains + weakly associated nodes)
3. b is FALSE then all of (C) are TRUE (strong chains again)
4. If (C) is TRUE...

AND

5. (A) will be TRUE in the case where there are N possibilities, and N-1 are already of the "if A is true, then this will be FALSE" variety (from 2). We have:

[ ? a b c d ... ]

Here we can say that "if A is true, then all of a, b, c, and d will be FALSE, and therefor ? will be TRUE.

This starts another cycle at step 2.

I'm supposing that you are doing this latter strategy and I the former, thus not quite solving the same set.

Is that possible?


Also, I guess I still don't get what a Magic cell is. What do you mean by

"knock-out by a Magic Cell r2c9 value 5"?

Sudoku Assistant isn't doing anything about Magic Cells, I don't think. It just solves the puzzles.

1) How does your solver identify a magic cell?

2) What does it then do with that information?

3) Doesn't the solver have to have the solution to "know" that a cell is a magic cell?

Thanks. This is getting very interesting, I think.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Tue Nov 01, 2005 8:48 pm    Post subject: Reply with quote

Regarding your questions about Magic Cells:

The forward logic in my tabling function considers all effects of each candidate in the unbound cells. This is done by simply checking the 4 constraints of the puzzle (1 digit per cell, alldifferent in each row, column and box).

When the implication tree of a particular cell+digit causes all remaining cells to be bound to a single digit (with no inconsistencies), placing this digit will automatically lead to a valid solution, without the need to revisit any of the advanced techniques, like subsets, coloring, tabling, or Medusa.

The implication trees are normally used to detect inconsistencies or verities as I explained earlier. However, since I have them now, I can also check which implication trees would completely solve the puzzle.

The term Magic Cell is not completely correct. It is not the cell that is doing the magic, but the placement of a particular candidate. It could be that others use the term Magic Cell for a cell that, no matter which candidate you choose, always solves the puzzle. But a cell that performs magic with a single candidate is good enough for me.

I use the Magic Cell simply as a shortcut. In some very complex puzzles, the solver has to revisit the tables again and again, eliminating one candidate at a time, until it finally breaks. When you are able to find a Magic Cell, you have a One-Hit-KO for the puzzle. I've checked the puzzles that were solved with Magic Cells, and each of them could also be solved with detection of inconsistencies and verities.

The solver does not have to "know" the solution in order to find a Magic Cell. The only restriction, same as with uniqueness tests, is that it assumes that the puzzle has only one solution.

If you find a solution, and you know there is only one solution, you have found the solution.

Congratulations on solving all 95. I'm still at 92... Have you tried the list of 795 fiendish 17-clue puzzles that Mark posted yet? I was able to solve all of them, so I guess you must be able to turn that list into mincemeat.

Ruud.
Back to top
View user's profile Send private message Visit poster's website
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Tue Nov 01, 2005 9:11 pm    Post subject: Reply with quote

Thanks, Ruud.

I have now confirmed that the Medusa+reverse logic ALONE solves all top95 puzzles. That is, no block-exclusion analysis, no n-tuples, no X-wings, grids, just strong chains and weak links.

This surprises me, and I don't really believe it is general. But it does show that block row/col exclusion, subset elimination, x-wings, and such are all pretty much the same thing.

But there could definitely be a puzzle with no strong chains, in which case I would argue this is THE most difficult puzzle -- no duplets anywhere, no rows, columns, or blocks with only two occurances of any candidate. Were this puzzle to be found, Medusa alone would not work. (Although maybe just relaxation of the restriction that only weak nodes be investigated would do the job, but I doubt it.)

I think it's safe to say that your logical implication chains are identical to Medusa. Thus, an "effect" amounts to identifying the strong chans and weak associated chains. You just aren't classifying them as such.

I had been making a mistake with what I was calling "forcing corners" that was actually producing unsolvable situations. That gone, all fell in line.

So I'm hoping that you can get all 95 to crack with forward-directed logic. I'm pretty sure both forward and reverse are the same thing, just seen from two different perspectives. Well, OK, not exactly the same thing, but I mean, covering the same bases. The key for you, if that is true, is to identify:

a) all cases where options for a candidate have been eliminated
[F F F F F...]

b) all cases where all except ONE option for a candidate has been eliminated
[? F F F F ...]

c) all cases for which two candidate possibilities are forced:
[T T ? ? ...]

Of course, I'm sure that is exactly what you are doing. So why those last three? The only other thing I can think of is if the forward also needs to check somehow for block row/cell exclusion. But the reverse doesn't seem to need to do that, so maybe that just falls out of the analysis.

You shouldn't have to check for whether a candidate is ELIMINATED, only if that candidate is TRUE. Right? Or do you have to check both possibilties? The reverse method only has to check for ELIMINATION, it turns out.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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