Grid
Grid
Bases: BaseModel
Store a grid of numbers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str | None
|
optional grid ID |
None
|
size
|
int
|
grid size |
required |
grid
|
list[list]
|
grid values |
<dynamic>
|
Source code in src/snailz/grid.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
__getitem__(key)
Get grid element.
Source code in src/snailz/grid.py
21 22 23 24 |
|
__setitem__(key, value)
Set grid element.
Source code in src/snailz/grid.py
26 27 28 29 |
|
__str__()
Convert to string.
Source code in src/snailz/grid.py
31 32 33 34 35 |
|
generate(size)
staticmethod
Make and fill in a grid.
Source code in src/snailz/grid.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
to_csv(writer, grid)
staticmethod
Convert to CSV.
Source code in src/snailz/grid.py
59 60 61 62 63 64 |
|