Maze solution for an AI trying to find the goal with a best-first algorithm