donjuan.grid¶
Module Contents¶
Classes¶
Abstract base class for a grid of cells. The underlying grid can either |
|
Rectangular grid of square cells. In a square grid, the cell positions are |
|
Rectangular grid of hexagonal cells. In a hex grid, the cell positions |
-
class
donjuan.grid.Grid(n_rows: int, n_cols: int, cells: Optional[List[List[Cell]]] = None, edges: Optional[List[List[List[Edge]]]] = None)[source]¶ Bases:
abc.ABCAbstract base class for a grid of cells. The underlying grid can either be square or hexagonal.
-
get_filled_grid(self) → List[List[bool]][source]¶ Obtain a 2D array of boolean values representing the
filledstate of the cells attached to the grid.
-
property
n_rows(self) → int¶
-
property
n_cols(self) → int¶
-
property
cells(self) → List[List[Cell]]¶
-
property
edges(self) → List[List[List[Edge]]]¶
-
reset_cell_coordinates(self) → None[source]¶ Helper function that sets the coordinates of the cells in the grid to their index values.
-
check_edges(self, edges: Optional[List[List[List[Edge]]]]) → None[source]¶ Check the dimensions of the edges.
-
-
class
donjuan.grid.SquareGrid(n_rows: int, n_cols: int, cells: Optional[List[List[SquareCell]]] = None)[source]¶ Bases:
donjuan.grid.GridRectangular grid of square cells. In a square grid, the cell positions are integers.
-
cell_type¶
-
-
class
donjuan.grid.HexGrid(n_rows: int, n_cols: int, cells: Optional[List[List[HexCell]]] = None)[source]¶ Bases:
donjuan.grid.GridRectangular grid of hexagonal cells. In a hex grid, the cell positions are integers, with odd rows being “offset” by half a cell size when rendered.
-
cell_type¶
-