Skip to content

TileSet

Bases: Iterable[Tile]

A tile set is an iterable that yields a tile for each coordinates in the grid by calling the tile fetcher.

Example

Assume the grid and the tile fetcher are already created.

You can create a tile set and iterate over the tiles.

tile_set = TileSet(
    grid=grid,
    tile_fetcher=tile_fetcher,
)

for tile in tile_set:
    ...
PARAMETER DESCRIPTION
grid

Grid

TYPE: Grid

tile_fetcher

Tile fetcher

TYPE: TileFetcher

__len__

Computes the number of tiles.

RETURNS DESCRIPTION
int

Number of tiles

__getitem__

Returns the tile.

PARAMETER DESCRIPTION
index

Index of the tile

TYPE: int

RETURNS DESCRIPTION
Tile

Tile

__iter__

Iterates over the tiles.

YIELDS DESCRIPTION
Tile

Tile