4 ms·
Maybe it does only horizontal and vertical steps. In that case it makes no difference, because the heuristic should always give you the Manhattan distance, whic
by _0ffh 4y ago
Maybe it does only horizontal and vertical steps. In that case it makes no difference, because the heuristic should always give you the Manhattan distance, which is equal for all options that don't overshoot the goal.
- squeaky-clean 4y agoThe blue squares show the nodes it checked, and with A star the entire map shouldn't be blue on an empty maze.
- eknkc 4y agoYeah _0ffh's point makes sense on the path found. But even if it finds a path that is basically one horizontal one vertical line, it should still check the immediate neighbors only.
- _0ffh 4y agoYeah right, in that case there's something wrong there! Maybe in the way it queues up the options.
- squeaky-clean 4y agoThink 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; });