A 2D pathfinder in Javascript