Re:An aesthetically pleasing pathfinding visualizer
by _0ffh on Saturday November 05, 2022 @08:44PM
(#33487527)
Yeah right, in that case there's something wrong there! Maybe in the way it queues up the options.
[ Parent
| on HN ]
Re:An aesthetically pleasing pathfinding visualizer
by squeaky-clean on Sunday November 06, 2022 @12:09AM
(#33488874)
Think I found it, if you change the sort in astar.ts to just return 1 or -1 based on the comparison it behaves like A-star.
untraversedTiles.sort((a, b) => {
if (heuristicCost[a.row][a.col] < heuristicCost[b.row][b.col]) {
return-1;
}
return 1;
});