|
pycrossword
0.3
Pure-Python implementation of a crossword puzzle generator and editor
|
This is a base class for word objects, basically consisting of a pair of (x, y) coordinates: the start coordinate given by Coords::start and the end coordinate given by Coords::end. More...
Public Member Functions | |
| 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... | |
| def | __repr__ (self) |
Python repr() overload: human-readable representation of Coords. More... | |
Public Attributes | |
| 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... | |
This is a base class for word objects, basically consisting of a pair of (x, y) coordinates: the start coordinate given by Coords::start and the end coordinate given by Coords::end.
All coordinates are given as 2-tuples (x, y): x = row, y = column (0-based)
| def pycross.crossword.Coords.__init__ | ( | self, | |
| coord_start, | |||
| coord_end | |||
| ) |
The Coords constructor: initializes and validates Coords::start and Coords::end.
| coord_start | 2-tuple the start coordinate (x, y) |
| coord_end | 2-tuple the end coordinate (x, y) |
| def pycross.crossword.Coords.__len__ | ( | self | ) |
Python len() overload: the distance between Coords::start and Coords::end.
| def pycross.crossword.Coords.__repr__ | ( | self | ) |
Python repr() overload: human-readable representation of Coords.
Reimplemented in pycross.crossword.Word.
| def pycross.crossword.Coords.coord_array | ( | self | ) |
Outputs a list of (x,y) coordinates (2-tuples) between Coords::start and Coords::end.
list a list of coordinate 2-tuples beginning with Coords::start and ending with Coords::end | def pycross.crossword.Coords.does_cross | ( | self, | |
| coord | |||
| ) |
Checks if a coordinate lies anywhere between Coords::start and Coords::end.
| coord | [tuple] the coordinate to check |
bool True if coord crosses (lies between Coords::start and Coords::end), False otherwise | def pycross.crossword.Coords.validate | ( | self | ) |
Validates the start and end coordinates passed to init().
| crossword::CWError | at least one coordinate is incorrect (relevant to the other) |
| pycross.crossword.Coords.dir |
str direction of the start-to-end vector: 'h' = 'horizontal', 'v' = 'vertical'
| pycross.crossword.Coords.end |
2-tuple the end coordinate (x, y)
| pycross.crossword.Coords.start |
2-tuple the start coordinate (x, y)
1.8.17