---
id: grid-a_star
name: Grid.a_star
category: grid
kind: namespace-method
tokens: Grid.a_star
sig: Grid.a_star(x0, y0, x1, y1, wall) -> []Cell
tip: The shortest 4-connected path between two cells (A*), or an empty list.
order: 5
ns: Grid
member: a_star
---
Returns the shortest path from (x0, y0) to (x1, y1) over passable (non-wall) cells, 4-connected with uniform step cost, as a Cell slice from start to goal inclusive — an A* search with a Manhattan heuristic. Empty if the goal is unreachable (or start/goal is a wall). (Named under Grid rather than Path, which is the filesystem-paths library.)
Parameters:
- `x0`, `y0` — the start cell
- `x1`, `y1` — the goal cell
- `wall` — the impassable tile char, e.g. `'#'`
```ludic
program Demo {
handler H phase Update {
let path = Grid.a_star(1, 1, 20, 12, '#')
if len(path) > 0 { print(len(path)) }
}
}
```