PHP 2D Maze Pathfinding using AStar algorithm