namespace
Grid
Tile geometry and pathfinding over the Map tilemap. A cell is passable unless it is out of bounds or holds the caller's wall tile (a char code, e.g. '#'), so any impassable glyph works. Everything is integer and deterministic — same map and query reproduce the same path every run. Grid.line/Grid.flood/Grid.a_star return Cell slices (index them with len / [i]; each cell has .x and .y).
Grid.line(x0, y0, x1, y1) -> []CellEvery cell a straight line from (x0,y0) to (x1,y1) crosses (Bresenham).Grid.blocked(x, y, wall) -> boolTrue if the cell is out of bounds or holds the wall tile.Grid.line_of_sight(x0, y0, x1, y1, wall) -> boolTrue if the straight line between two cells crosses no wall.Grid.flood(x, y, wall) -> []CellEvery passable cell reachable from (x,y), 4-connected, in BFS order.Grid.a_star(x0, y0, x1, y1, wall) -> []CellThe shortest 4-connected path between two cells (A*), or an empty list.