javascript-astar icon indicating copy to clipboard operation
javascript-astar copied to clipboard

Diagonal heuristic computes square root of 2 every time it is used

Open peterjwest opened this issue 8 years ago • 1 comments

Would help performance to do this as a constant outside the function.

peterjwest avatar Apr 26 '16 16:04 peterjwest

Also, the final line of heuristics.diagonal can be simplified to: return D * Math.abs(d1 - d2) + Math.min(d1, d2) * D2;

peterjwest avatar Apr 26 '16 16:04 peterjwest