A* algorithm for pathfinding on a tile grid in JavaScript.