From: Adam Shelly Date: 2005-08-25T07:20:49+09:00 Subject: Re: [QUIZ] Sodoku Solver (#43) On 8/24/05, Kroeger Simon (ext) wrote: > > > Ok, here's my latest. My big speedup was figuring out that if I make > > a bad guess, I just eliminate that possibility and re-solve. See the > > startGuessing method.. > > hmm ... I use cells with only 2 possibilities left for guessing, so if I > > guess wrong, at least I know the right guess. (of course only if there > are cells with 2 possibilities - but that happens often) If I interpret > your guess method right you are doing the same thing. So I do not > understand where the speedup comes from. > I went back and looked at the differences between the two versions. After a bad guess, my first version made another guess with the next possibility on the same cell. Now it just removes the bad guess and goes back to the logical solver. I also speeded up the guesser itself - it used to check all the cells for the one with the minimum number of possibilites, now it just finds the first with 2 possibilities. So that's why mine got better, but it was bad before. I'd like to directly compare the speed of yours to mine on my machine, but I can't get it to run correctly, It reports every board as UNSOLVABLE. Has anyone else had any luck with it? >Your 'findPairs' looks promissing... I think I will try something >similar... I thought that I could speed it up by deducing more cells before I started guessing, soI tried adding another step to the logic phase: If any row or col has all it's instances of a given digit in the same 3x3 box, then that digit can be removed from the other 6 cells in the box. But it turned out to make the code slower, I think because it wasn't very efficient, and in most cases it only ended up solving 1 or 2 extra cells before having to go to the guesser anyway. -Adam