How does a map app find your route? Build a maze and watch two classic methods search it.
Blue squares are places the search has looked at. The gold line is the shortest route it found.
The first method is called breadth-first search. The second is called A-star, and it uses a guess of the distance left to steer the search toward the goal.
Keep watching