A* Pathfinding

T: O(E log V)
Feedback

A* Pathfinding

Initializing A* search...
StartEndCurrentOpenClosedPath
SpeedNormal (500ms)
Parameters

{ grid: "empty"|"wall"|"start"|"end"[][], start: [r,c], end: [r,c] }

Variables
openSet1
closedSet0
1function AStar(grid, start, end):
2 openSet = {start}
3 gScore[start] = 0
4 fScore[start] = heuristic(start, end)
5 while openSet not empty:
6 current = node in openSet with lowest fScore
7 if current == end:
8 return reconstructPath()
9 move current to closedSet
10 for each neighbor of current:
11 tentative_g = gScore[current] + 1
12 if tentative_g < gScore[neighbor]:
13 update cameFrom, gScore, fScore
14 add neighbor to openSet
Output
Initializing A* search...