mini_arcade_core.scenes.systems.builtins.falling_blocks¶
Reusable falling-block gameplay helpers for stacking puzzle games.
Classes¶
Dense visible board state for stacking puzzle games. |
|
One falling-piece definition with precomputed rotation states. |
|
Active falling piece instance positioned on a board grid. |
|
Deterministic bag-based sequence generator. |
|
Declarative row-clear rule for one falling-block board. |
|
Clear fully occupied rows and collapse the board downward. |
Functions¶
Parse one rotation from ASCII rows into local grid cells. |
|
|
Return whether an active piece fits on a board without collisions. |
Module Contents¶
- mini_arcade_core.scenes.systems.builtins.falling_blocks.block_cells_from_strings(*rows: str, filled_chars: str = '#XO@[]') tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, Ellipsis][source]¶
Parse one rotation from ASCII rows into local grid cells.
- class mini_arcade_core.scenes.systems.builtins.falling_blocks.BlockBoard[source]¶
Bases:
Generic[TCell]Dense visible board state for stacking puzzle games.
- cols: int¶
- rows: int¶
- empty: TCell | None = None¶
- in_bounds(coord: mini_arcade_core.scenes.systems.builtins.grid.GridCoord) bool[source]¶
Return whether a cell lies inside the visible board.
- get(coord: mini_arcade_core.scenes.systems.builtins.grid.GridCoord) TCell | None[source]¶
Return the stored value for a visible cell.
- set(coord: mini_arcade_core.scenes.systems.builtins.grid.GridCoord, value: TCell | None) None[source]¶
Write a value into a visible cell.
- clear(coord: mini_arcade_core.scenes.systems.builtins.grid.GridCoord) None[source]¶
Reset one visible cell to the configured empty value.
- occupied_cells() tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, Ellipsis][source]¶
Return the coordinates of all non-empty cells.
- occupied_entries() tuple[tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, TCell], Ellipsis][source]¶
Return coordinates paired with stored cell values.
- can_place(cells: Iterable[mini_arcade_core.scenes.systems.builtins.grid.GridCoord], *, allow_rows_above_board: bool = False) bool[source]¶
Return whether the given cells can be occupied without collisions.
- stamp(cells: Iterable[mini_arcade_core.scenes.systems.builtins.grid.GridCoord], *, value: TCell, ignore_rows_above_board: bool = True) tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, Ellipsis][source]¶
Write one value into multiple cells and return written coordinates.
- class mini_arcade_core.scenes.systems.builtins.falling_blocks.FallingBlockPieceSpec[source]¶
One falling-piece definition with precomputed rotation states.
- name: str¶
- rotations: tuple[tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, Ellipsis], Ellipsis]¶
- cells(rotation: int = 0) tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, Ellipsis][source]¶
Return the local cells for the normalized rotation index.
- class mini_arcade_core.scenes.systems.builtins.falling_blocks.FallingBlockPiece[source]¶
Active falling piece instance positioned on a board grid.
- spec_name: str¶
- rotation: int = 0¶
- translated(*, dcol: int = 0, drow: int = 0) FallingBlockPiece[source]¶
Return a translated copy of the active piece.
- rotated(delta: int = 1) FallingBlockPiece[source]¶
Return a copy rotated by a relative delta.
- cells(spec: FallingBlockPieceSpec) tuple[mini_arcade_core.scenes.systems.builtins.grid.GridCoord, Ellipsis][source]¶
Return the occupied board cells for this active piece.
- mini_arcade_core.scenes.systems.builtins.falling_blocks.piece_fits(board: BlockBoard[TCell], piece: FallingBlockPiece, spec: FallingBlockPieceSpec, *, allow_rows_above_board: bool = False) bool[source]¶
Return whether an active piece fits on a board without collisions.
- class mini_arcade_core.scenes.systems.builtins.falling_blocks.BagRandomizer[source]¶
Bases:
Generic[TItem]Deterministic bag-based sequence generator.
- items: tuple[TItem, Ellipsis]¶
- seed: int = 1¶
- class mini_arcade_core.scenes.systems.builtins.falling_blocks.BoardRowClearBinding[source]¶
Bases:
Generic[TCtx]Declarative row-clear rule for one falling-block board.
- board_getter: Callable[[TCtx], BlockBoard[object]]¶