added A* pathfinding algorithm