News for hackers. Stuff that matters.
Re:Sudoku Solving by ondrasej on Saturday March 26, 2011 @03:56AM (#2371614)
If you do the constraint propagation right, the number of trials and errors will be very small (and it will be only one trial and no errors for the easy ones).

I'd be very interested to see what an algorithm that solves any valid sudoku puzzle looks like. (apart from pathologic solutions like querying a database of all valid 9x9 sudoku combinations).

Re:Sudoku Solving by crux_ on Saturday March 26, 2011 @05:06AM (#2371700)
That would be a big database. (10^21 entries,roughly.) http://en.wikipedia.org/wiki/Mathematics_of_Sudoku#Enumerati...
Re:Sudoku Solving by ondrasej on Saturday March 26, 2011 @01:24PM (#2372615)
That's why I called it pathologic... ;)

Edit: using the symmetries described in the same Wikipedia article, the size of the database could be reduced significantly to roughly 5*10^9, which is quite manageable.

Re:Sudoku Solving by jules on Saturday March 26, 2011 @07:46AM (#2371873)
> I'd be very interested to see what an algorithm that solves any valid sudoku puzzle looks like.

You might be interested in the article linked to by this post.

Re:Sudoku Solving by ondrasej on Saturday March 26, 2011 @01:34PM (#2372638)
The code in the post is based on depth-first search, which basically is a trial and error approach. A well implemented and effective one thanks to constraint propagation, but it is still trial and error. And there are cases, in which backtracking (trial and error) is necessary - at least one of them is documented in the post (the puzzle "hard1" that took 188 seconds).
Re:Sudoku Solving by jules on Saturday March 26, 2011 @03:58PM (#2373003)
There is no meaningful difference between trial and error and without trial and error. It makes this no less of an algorithm.
Re:Sudoku Solving by wccrawford on Saturday March 26, 2011 @04:53AM (#2371677)
If you get down to trial and error at all, your best odds are 50/50. If it's easy enough to guarantee the right guess, it's not a guess.