Javascript A* Pathfinder