|
pycrossword
0.3
Pure-Python implementation of a crossword puzzle generator and editor
|
Implementation of a single word in a hypothetical crossword. More...
Public Member Functions | |
| def | __init__ (self, coord_start, coord_end, num=0, clue='', word=None) |
| Initializes and validates data. More... | |
| def | set_word (self, wd) |
| Sets the internal word string (text). More... | |
| def | __hash__ (self) |
Python hash() overload: to make Word objects comparable / searchable in collections. More... | |
| def | __repr__ (self) |
Python repr() overload: human-readable representation of Word object. More... | |
Public Member Functions inherited from pycross.crossword.Coords | |
| def | __init__ (self, coord_start, coord_end) |
| The Coords constructor: initializes and validates Coords::start and Coords::end. More... | |
| def | validate (self) |
| Validates the start and end coordinates passed to init(). More... | |
| def | coord_array (self) |
Outputs a list of (x,y) coordinates (2-tuples) between Coords::start and Coords::end. More... | |
| def | does_cross (self, coord) |
| Checks if a coordinate lies anywhere between Coords::start and Coords::end. More... | |
| def | __len__ (self) |
Python len() overload: the distance between Coords::start and Coords::end. More... | |
Public Attributes | |
| num | |
int word number (in a hypothetical cw grid) More... | |
| clue | |
str word clue text More... | |
| word | |
str word text More... | |
Public Attributes inherited from pycross.crossword.Coords | |
| start | |
2-tuple the start coordinate (x, y) More... | |
| end | |
2-tuple the end coordinate (x, y) More... | |
| dir | |
str direction of the start-to-end vector: 'h' = 'horizontal', 'v' = 'vertical' More... | |
Implementation of a single word in a hypothetical crossword.
The class adds to Coords the word number (as found in a crossword), word string, and clue text.
| def pycross.crossword.Word.__init__ | ( | self, | |
| coord_start, | |||
| coord_end, | |||
num = 0, |
|||
clue = '', |
|||
word = None |
|||
| ) |
Initializes and validates data.
| coord_start | 2-tuple the start coordinate (x, y) |
| coord_end | 2-tuple the end coordinate (x, y) |
| num | int word number (in a hypothetical cw grid) |
| clue | str word clue text, e.g. "NBA superstar Jordan's first name" |
| word | str word text, e.g. "FATHER" |
| def pycross.crossword.Word.__hash__ | ( | self | ) |
Python hash() overload: to make Word objects comparable / searchable in collections.
| def pycross.crossword.Word.__repr__ | ( | self | ) |
Python repr() overload: human-readable representation of Word object.
Reimplemented from pycross.crossword.Coords.
| def pycross.crossword.Word.set_word | ( | self, | |
| wd | |||
| ) |
Sets the internal word string (text).
| wd | str the word text |
| crossword::CWError | passed word has incorrect length (not corresponding to Coords::len()) |
| pycross.crossword.Word.clue |
str word clue text
| pycross.crossword.Word.num |
int word number (in a hypothetical cw grid)
| pycross.crossword.Word.word |
str word text
1.8.17