Occupancy Module
Functions and values
| Function or value |
Description
|
|
How a span reads in a message: `6x4`, `radius 2`, or `one cell`.
|
|
An occupancy where every populated cell owns itself, built without consulting a span. For a map whose words never span.
|
|
The identity spans: `One`, `Span(1, 1)`, and `Radius 0` all cover one cell. A word that declares one of them places a single cell, and needs no expansion or geometry check.
|
|
Calls `action` with the cell and the rectangle of every anchor whose rectangle intersects the cell-space box. `left`, `top`, `right`, and `bottom` are inclusive cell coordinates, so an anchor that covers a window cell from outside it is still reported. The walk reads every anchor, so prefer it for maps up to a few thousand instances and hoist it out of a hot loop otherwise. |
|
|
|
|
Full Usage:
scan spanOf grid
Parameters:
'T -> InstanceSpan
grid : CellGrid2D<'T>
Returns: Result<Occupancy, string>
Type parameters: 'T |
Expands every populated cell through `spanOf`, validates the result, and answers which instance owns each cell. A span claims the cells it covers: a plain cell inside a span's rectangle is covered rather than reported as a second instance. Fails with a cell-named reason when a span leaves the grid, when two spans overlap, when a span covers nothing, or when the span shape and the grid geometry disagree.
|
Mibo