Peter Norvig: Solving Every Sudoku Puzzle
Peter Norvig wrote up a nice Sodoku solver in Python. Here's an excerpt:
Setting Up the Problem
First we have to agree on some notation. After looking at a few Sudoku sites I notice that there is not universal agreement, but the majority favor labeling the rows A-I, the columns 1-9, and calling a collection of nine squares (either a row, a column, or a box) a unit, and calling the other squares in a unit that square's peers. We can implement this in the programming language Python as follows:
|
What I like about his post is that shows a clean analysis and solution to the problem, and manages to teach a bit of CS and engineering at the same time.
Read more on Peter's site: Solving Every Sudoku Puzzle
No comments:
Post a Comment