[wxPython-users] First wxpython program: a sudoku program
Jason Wang
randomtalk at gmail.com
Thu Oct 5 10:10:50 PDT 2006
mmm.. Well, it was Norvig's solver that got me interested in the first
place. Currently i have hooked up his solver to the GUI, so the user
can input the puzzle manually by entering the numbers, press solve,
it'll output the whole solution using his solver.
I'm trying to write a generator right now, after that's done, prob
ganna continue to work on the GUI and make it better, after i have the
generator done, i'll post the file again. The thing is that Norvig's
solver is kinda of simple, it doesn't to my knowledge check for
multiple solutions and what not, which is required to make a generator
that creates unique puzzles.
On 10/5/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:
>
> A few notes:
>
> It uses a numpy-based class for storing the puzzle, including methods
> for checking for validity of the rows, columns and boxes. This
> demonstrates some of the power of numpy arrays:
> - a 2-d array is a natural way to store this puzzle
> - you can pull slices out of that array, using a view to the same
> data, for rows, columns and the boxes.
>
> I re-did the gui to draw the grid differently. Instead of drawing
> rectangles, I draw a bunch of lines where needed. It also calculates the
> geometry in the OnSize method, then stores that for use in drawing and
> figuring out where the mouse is clicked, etc.
>
> I have not implemented Robin's suggestion to only re-draw the part of
> the puzzle that has changed -- that is a good idea, but computers are so
> fast now that I haven't bothered.
>
> The gui now highlights any rows, columns, or boxes that are invalid.
>
Thank you for helping me so much! I'll figure out all that you have
done in the latest file over the weekend :D
--
"It's a wonderful world hobbes ol' buddy, let's go explorin'!" -
Calvin in "Calvin and Hobbes"
More information about the wxpython-users
mailing list