The Caver Algorithm
Uploader Comments (RJLeffmann)
Video Responses
All Comments (29)
-
When I did a maze generator a long time ago, I had a parameter telling the chanse of continuing to dig straight forward or to turn left or right. That way I could set how wriggly the maze would be.
Another parameter I would introduce if I did this today is a random chanse to stop digging and start a new branch. This way I could set if there will be few or many dead ends.
-
This is very similar to Trémaux's algorithm.
-
what's the maze generation algorithm?
-
I did this in college.
You can improve the maze-generating algorithm by starting at the end and generating towards the start. This means the start square will likely have two paths, one of which will always be a dead end. If you generating starting at the start, the end square will have two paths, one of which will never be traversed.
(continued)
0:26 and 0:36, assuming the solver knew the boundaries of the maze, it should have also known that the directions it headed were dead ends. Euclidean distance checks at T intersections are the key here :)
trjnz 3 months ago
@trjnz Yes - given that it's trying to reach a known coordinate. If you're trapped in a maze then you probably don't know where the actual exit is :)
RJLeffmann 2 months ago
Is this an example of backtracking?
metabog 4 months ago
@metabog Yes it is. Both the generator and solver are depth-first search algorithms that will track back when they find themselves in a dead end that will not lead to a solution.
RJLeffmann 4 months ago 4
You can also improve the maze solving algorithm by making it try squares that reduce the euclidean distance to the end in most-to-least order, since solutions are more often direct than not.
domokato 1 year ago 2
@domokato Good thinking, and I agree on the heuristic for solving the maze, it would probably make it a lot quicker. I'll try it out some day.
RJLeffmann 1 year ago 2