/** A fixed-size 2D board of cells, row-major from the top-left; `null` is an empty cell. Plain data, so it serializes and restores as-is. */ export interface CellGrid { readonly width: number; readonly height: number; readonly cells: readonly (T | null)[]; } /** A straight line of matching cells found by {@link findRuns}. */ export interface CellRun { readonly value: T; readonly cells: readonly { readonly x: number; readonly y: number; }[]; readonly direction: "row" | "column"; } /** * An empty `width` × `height` board. Every helper here returns a new grid, so a store slot can hold it * and undo, replay, and save/restore work without copying. * @capability cell-grid immutable 2D board of cells with row clears, gravity collapse, and match runs */ export declare function createCellGrid(width: number, height: number): CellGrid; /** Whether `(x, y)` lies on the board. */ export declare function inGridBounds(grid: CellGrid, x: number, y: number): boolean; /** The value at `(x, y)`, or `null` when empty or off the board. */ export declare function cellAt(grid: CellGrid, x: number, y: number): T | null; /** A copy with `(x, y)` set to `value`; off-board writes return the grid unchanged. */ export declare function withCell(grid: CellGrid, x: number, y: number, value: T | null): CellGrid; /** A copy with every in-bounds entry written; one allocation for a whole piece or stamp. */ export declare function withCells(grid: CellGrid, entries: readonly { readonly x: number; readonly y: number; readonly value: T | null; }[]): CellGrid; /** Indices of rows with no empty cell, top to bottom. */ export declare function fullRows(grid: CellGrid): number[]; /** A copy with `rows` removed and the rows above shifted down, refilling empty rows at the top. */ export declare function clearRows(grid: CellGrid, rows: readonly number[]): CellGrid; /** A copy where every column's cells fall to the bottom, keeping their order. */ export declare function collapseColumns(grid: CellGrid): CellGrid; /** Horizontal and vertical runs of at least `minLength` cells whose values `matches` (default `===`). */ export declare function findRuns(grid: CellGrid, minLength: number, matches?: (a: T, b: T) => boolean): CellRun[];