This javascript utility utilizes breadth-first-search (BFS) to determine the shortest path through a maze.

The BFS search method was invented by professor Edward F. Moore and solving a binary maze was one of it's demonstrated uses.

Start:

End:

BFS works by adding every possible direction to a queue of possible next steps. each step away from the first, the system searches for every possible continuation of the trail. I like to think of it as an octopus spreading in all directions. A tentacle reaches down every trail. When it reaches a crossroads, it creates a new octopus that spreads it's tentacles out from there. This allows the system to search all paths at once. As soon as any tentacle hits the destination, then the system should know that was the shortest path- otherwise it would have already been reached through some other route.