A stupid Sudoku solver in Python (and PyGTK)

During the holidays i was bored out of my mind. Holidays in my family means that we gather some close relatives and friends at our house and eat. Not once. Not twice, but every freaking day. So when a sudoku magazine fell in my hands i thought it would be fun to try and write a sudoku solver. So here it is:
PySudoku UPDATE Because of a server move the tarball is unavailable. Get it using Subversion from svn://arcanum.homelinux.org/sudoku

This stupid little program is written in Python and PyGTK so you need both to run it.

There are some bugs:

  • It can be slow in certain puzzles.
  • It is either too slow or in a loop when the puzzle has no solution.
  • It won’t check if you enter an invalid puzzle from the start (which is easy to do. i am lazy)
  • Probably more things i can’t remember now :)

It does not generate puzzles, not because i don’t know how to do it but because my backtracking solver it so slow that it would be painful to try generating a solution with the “try a random number / see if there is a solution/ try another etc etc.” method.
There are far better solver/generators out there if you are looking for one. Mine is just a toy i did for fun.

Comments !