An implementation of A* pathfinding