Generic synchronous A* search algorithm.
var aStar = ;// if this is going to take a while you may want to child_process.fork// and pass the results to the parent process// see below for optionsvar path = ;console;
Returns an object that looks like this:
status: 'success' // one of ['success', 'noPath', 'timeout']path: startNode node1 node2 ... endNode
success- a path was found and
pathis an array of nodes including start and end.
noPath- there is no path from start to end.
pathis the path to the closest node to end that could be found.
timeout- no path was found in the allotted time.
pathis the path to the closest node that could be found in the allotted time.
start- the start node
isEnd- function(node) that returns whether a node is an acceptable end
neighbor- function(node) that returns an array of neighbors for a node
distance- function(a, b) that returns the distance cost between two nodes
heuristic- function(node) that returns a heuristic guess of the cost from
nodeto an end.
timeout- optional limit to amount of milliseconds to search before returning null.
The data type for nodes is unrestricted.