API Reference › Grid › Grid.flood
method

Grid.flood

Grid.flood(x, y, wall) -> []Cell

Returns every passable cell reachable from (x, y) by 4-connected steps (up/down/left/right over non-wall cells), in breadth-first order — for connectivity checks, filling a room, or measuring an enclosed area. Empty if the start itself is blocked.

Parameters

wallthe impassable tile char

Example

program Demo {
  handler H phase Update {
    let region = Grid.flood(2, 2, '#')
    print(len(region))
  }
}
← All symbols