<astar> ( neighbors cost heuristic -- astar )
Path finding using the A* algorithm

Next:<bfs> ( neighbors -- astar )


Vocabulary
path-finding

Inputs
neighborsa quotation with stack effect ( node -- seq )
costa quotation with stack effect ( from to -- cost )
heuristica quotation with stack effect ( pos target -- cost )


Outputs
astaran astar


Word description
Build an astar object from the given quotations. The neighbors one builds the list of neighbors. The cost and heuristic ones represent respectively the cost for transitioning from a node to one of its neighbor, and the underestimated cost for going from a node to the target. This solution may not be as efficient as subclassing the astar tuple.

See also
<bfs>, <dijkstra>

Definition