alexdej / puzpy

Python library for reading and writing across lite crossword puzzle .puz files.
MIT License
112 stars 32 forks source link

Add clue index for across/down mapping help #20

Closed oeuftete closed 3 years ago

oeuftete commented 5 years ago

This is to support tools that may want to manipulate clues based on whether they are across or down. I think this would be fairly complex without this addition. Maybe there's an easier way.

Here's how the addition here might be used:

def convert_to_downs_only(p):
    for i in map(lambda c: c['clue_index'], p.clue_numbering().across):
        p.clues[i] = '-'

    #  clear any previous cached numbering
    p.helpers.pop('clues', None)
alexdej commented 3 years ago

lgtm. thanks for contributing