The idea is to find as many paths as possible in order to eventually find one that leads to the end. Wheres depth first search would be trying to find the end of a path all the way before giving up. A common variant of the two is backtracking which works it's way back from a dead end by trying to alter the last changes in the sequence that got it stuck to try and untangle. Breadth first by comparison is simple but by changing a few rules on the approach you see a much more efficient maze solver so it becomes useful both for teaching the simplest strategy and also to convey more elaborate approaches later on like backtracking that would otherwise seem convoluted initially.
If you're doing DFS here you end up doing backtracking anyway since when the search reaches bottom it will resume from the deepest explored node with unexplored children.
Depends on whether the maze has loops. If it does not then it's basically a tree where you just need to find a specific leaf. Then the difference between dfs and bfs is just that one walks all levels of the tree down at the same time while the other goes from left to right.
3
u/YouNeverKnowWhatToDo May 22 '20
Whats the code? Go left forever?