[wxPython-users] First wxpython program: a sudoku program
Marc Hedlund
marc at precipice.org
Thu Oct 5 10:01:40 PDT 2006
Not sure if this has already been mentioned in this thread, but if you
haven't seen it, check out Peter Norvig's sudoku solver in Python:
http://www.norvig.com/sudoku.html
(He works at Google.) Interesting as a programming exercise even if you
don't like the puzzles. Maybe this would fit into the project.
-M
On Thu, 5 Oct 2006, Christopher Barker wrote:
> Jason Wang wrote:
>> Thank you so much for the suggestions! I've modified the program
>> according to the suggestions and is expanding the program to do more,
>> with any luck, i might even make it a full featured puzzle solver :D
>
> This got me interested, so I started with what you last posted, implemented
> my own suggestions, and a bunch more, and now have the enclosed.
>
> 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.
>
> When you've got something you like, make sure to put it in the Wiki or
> something -- there's some good stuff here.
>
> enjoy!
>
> -Chris
>
>
>
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
> NOAA/OR&R/HAZMAT
> (206) 526-6959 voice
> 7600 Sand Point Way NE (206) 526-6329 fax
> Seattle, WA 98115 (206) 526-6317 main reception
>
> Chris.Barker at noaa.gov
>
More information about the wxpython-users
mailing list