I'm a little surprised no one's tried a parallel solution yet,
actually.
We've got an SMP runtime for a reason, people!
I hacked up a parallel version of Richard Bird's function pearl solver:
http://www.haskell.org/sitewiki/images/1/12/SudokuWss.hs
It not really optimized, but there are a few neat tricks there.
Rather than prune the search space by rows, boxes, and columns
sequentially, it represents the sudoku grid by a [[TVar [Int]]],
where every cell has a TVar [Int] corresponding to the list of
possible integers that would 'fit' in that cell. When the search
space is pruned, we can fork off separate threads to prune by
columns, rows, and boxes -- the joy of STM!
Wouter
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe