timpalpant / LittleBoxes

A crossword solver
GNU General Public License v3.0
1 stars 0 forks source link

Refactor the Crossword class to be a collection of XWClues. #8

Closed timpalpant closed 8 years ago

timpalpant commented 8 years ago

Introduce a new XWClue structure that represents individual clues in the Crossword puzzle. They are created when a Crossword is loaded. Each Clue holds the indices of its boxes in the main Crossword array. The Crossword class keeps track of the solution and handles all modifications to it.

The main advantage is that across and down clues are treated the same when getting/setting squares in the puzzle (get_fill, set_fill, would_conflict). And because the XWClue objects are small immutable namedtuples, they can be used as dictionary keys when it's convenient.

jpalpant commented 8 years ago

Nice unit tests! Looks good to me. I need to make sure to stay up on requirements, I haven't been doing that