Skip to content

five-on-it / packages/ai/src/pathfinding / astar

Function: astar() ​

astar(graph, start, goal, maxExpansions, s): AstarResult

Defined in: packages/ai/src/pathfinding.ts:154

Plans from start to goal with at most maxExpansions expansions (see the module documentation). An unreachable goal, or a spent budget, gives the path to the expanded node with the smallest heuristic, incomplete.

Parameters ​

graph ​

SearchGraph

start ​

number

goal ​

number

maxExpansions ​

number

s ​

AstarScratch

Returns ​

AstarResult