Cooper likes cake
Sunday, April 22, 2007
Friday, April 20, 2007
Saturday, April 14, 2007
Thursday, April 12, 2007
Sudoku Solver
I've had this code laying around for a year, so I cleaned it up a little and decided to post it.
I work with people who like to solve logic puzzles. At some point we started doing the sudoku puzzles in the newspaper. After solving a few, it was obvious to us that they could be solved programmaticlly. This led to us trying to not just solve a single puzzle, but the meta-problem of solving sudoku puzzles in general. So we challenged each other to writing sudoku solvers. One person did his in Perl in a couple hours. I wrote mine in Python as a way to start learning the language. At the time it took me more than a couple hours, but I got it working. Every sudoku I could find can be solved in fractions of a second. Not long after that, Scientific American came out with an article on The Science behind Sudoku. The article has a puzzle with the minimum number of clues that still give a unique solution (17 clues). This puzzle is the only one I've found that actually takes some CPU cycles to solve. Needless to say, once we wrote the solvers, sudoku quickly lost its appeal.
My sudoku solver source file:
sudoku.python
Some input files:
easy
hard
diabolical
sciam 17 clue
I've had this code laying around for a year, so I cleaned it up a little and decided to post it.
I work with people who like to solve logic puzzles. At some point we started doing the sudoku puzzles in the newspaper. After solving a few, it was obvious to us that they could be solved programmaticlly. This led to us trying to not just solve a single puzzle, but the meta-problem of solving sudoku puzzles in general. So we challenged each other to writing sudoku solvers. One person did his in Perl in a couple hours. I wrote mine in Python as a way to start learning the language. At the time it took me more than a couple hours, but I got it working. Every sudoku I could find can be solved in fractions of a second. Not long after that, Scientific American came out with an article on The Science behind Sudoku. The article has a puzzle with the minimum number of clues that still give a unique solution (17 clues). This puzzle is the only one I've found that actually takes some CPU cycles to solve. Needless to say, once we wrote the solvers, sudoku quickly lost its appeal.
My sudoku solver source file:
sudoku.python
Some input files:
easy
hard
diabolical
sciam 17 clue
Sunday, April 08, 2007
Saturday, April 07, 2007
Friday, April 06, 2007
Wednesday, April 04, 2007
Subscribe to:
Posts (Atom)