Skip to main content

astar_grid2d

Function astar_grid2d 

Source
pub fn astar_grid2d(
    start: (usize, usize),
    goal: (usize, usize),
    width: usize,
    height: usize,
    walkable: &dyn Fn(usize, usize) -> bool,
    diagonal: bool,
) -> Option<AStarResult<(usize, usize)>>
Expand description

Convenience: A* on a 2D grid with a walkability map.

Coordinates are (x, y) with 0 <= x < width, 0 <= y < height. walkable returns true if the cell can be entered. Uses Chebyshev distance as the heuristic (diagonal movement allowed).