javascript-astar
javascript-astar copied to clipboard
Diagonal heuristic computes square root of 2 every time it is used
Would help performance to do this as a constant outside the function.
Also, the final line of heuristics.diagonal
can be simplified to:
return D * Math.abs(d1 - d2) + Math.min(d1, d2) * D2;