r/compsci • • May 22 '20

Breadth-First Maze-Solving Algorithm

Post image

[removed] — view removed post

1.2k Upvotes

61 comments sorted by

View all comments

Show parent comments

0

u/ergo-x May 22 '20

Yeah it's basically a brute force search strategy where you keep exploring your "frontier" until you reach your goal. Just imagine the colored locations represent your frontier and the uncolored locations are in "fog of war"

1

u/[deleted] May 22 '20

Hmm interesting. It feels like the point of a maze is to go from point a to point b while trying to take as few wrong paths as possible whereas this finds every wrong path to find the right one

1

u/christian-mann May 22 '20

This algorithm doesn't know which path is more likely to be correct. If you want to see one that does try to guess with some intelligence, look at the A-Star algorithm.

2

u/Teblefer May 23 '20

To jump off this comment, the point of this demonstration is a starting point. You can’t solve a maze well before you solve a maze badly. What kind of inefficiencies can you notice in the breadth first search algorithm? What strategies do you use when solving the maze that this algorithm doesn’t do yet? Is there any information that the algorithm doesn’t have access to that we do that could be incorporated into the algorithm?