By Thierry.Lefort
via exampledepot.com
Published: Sep 06 2008 / 11:43
The Sudoku puzzle consists of a grid of 9x9 cells. This 81-cell grid is further subdivided into nine subgrids of 3x3 cells. A few of the cells are filled with a single digit between 1 and 9 (the givens). To solve the puzzle, the empty cells must be filled in such a way that every 9-cell row, column, and subgrid contains each of the digits between 1 and 9.
Comments
Daniel Dyer replied ago:
How fast is this approach?
jf110361 replied ago:
On my 2.6GHz Intel Core 2 Duo iMac, it takes 30 milliseconds. A similar Perl script (but one that doesn't detect unsolvable or multiple solution problems) takes 1 millisecond. The only thing slow about Sudoku is humans (either inputting the puzzle or solving it).
Daniel Dyer replied ago:
Thanks, sounds plenty fast enough. I was just wondering how it would compare to the dancing links algorithm (http://en.wikipedia.org/wiki/Dancing_Links) that seems to be preferred by some Sudoku solvers.
Voters For This Link (16)
Voters Against This Link (0)