Crossword program; strategy for board implementation

Hi –

I’m relatively new to wxPython but have been learning the basics for application UI (menus, toolbars, dialogs, etc.).

I’m designing a program to play crosswords, and wanted some advice on how to handle drawing the main board. For those that don’t know/can’t visualize crosssords, easily, this is a grid (usually around 15x15, but could be as large as 30x30) with some squares blacked out, where letters are entered into the non-blacked-out squares.

I’ve thought of three possible ways to implement the board:

  • as a wx.Grid. This has the advantage of a lot of work being done for–the layout is easy, it already handles mousing and arrowing from cell to cell, and there’s already text entry into each cell. The challenge is that I need to show more than just the entered letter into each cell–I also need to show the clue number in each cell, and this isn’t something the player can edit.

  • as a Box sizer holding a bunch of panels. I could draw borders around the panels to make the crossword grid. I’d have to handle the mousing/cursoring around and the text entry into each space. It would be easy to put the clue #s in the panels, though.

  • drawing directly onto the canvas, making my own lines. I’d have to do just about everything, but this feels “lighter” than the other ways, which might matter for larger crosswords.

I’d appreciate any wisdom from more experienced designers on the positives or drawbacks for any of these methods, or for any other advice on how to proceed.

Thanks!

  • Joel

This is most likely the best approach to take. Search the list archive for discussions about Sudoku games for more information about why and some examples that can help you with the how.

···

On 5/16/12 4:58 PM, Joel Burton wrote:

- drawing directly onto the canvas, making my own lines. I'd have to do
just about everything, but this feels "lighter" than the other ways,
which might matter for larger crosswords.

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

- drawing directly onto the canvas, making my own lines. I'd have to do
just about everything, but this feels "lighter" than the other ways,
which might matter for larger crosswords.

This is most likely the best approach to take. Search the list archive
for discussions about Sudoku games for more information about why and
some examples that can help you with the how.

I agree, but not for the reasons Joel stated. Crossword puzzles have a
very specific look -- specific fonts, specific proportions, specific
positioning. If you used a standard control, you'd spend a lot of time
fighing the control to get the exact right look. By drawing it
yourself. you get exactly what you want.

I mean, let's be honest: performance is NEVER going to be an issue in a
crossword puzzle app...

···

On 5/16/12 4:58 PM, Joel Burton wrote:

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Thanks, Tim and Robin. I found the helpful Soduko posts you referred to.

In order to understand the code better, I cleaned it up a bit, removed extraneous bits, and added comments. This might be useful to other people.

sudoku(1).py (4.54 KB)