The algorithm really shines when craving process get's stuck (only visited nodes around), then it backtracks and creates alternative routes for the maze. That's kind of the point of a maze, that there are different paths and you can take wrong or right one. When I add extra dimensions (3rd one) to the algorithm to create a 3D maze, it almost never gets stuck because there are so much directions now to go and for most it's just one way path. I wonder if there is some trick to fix this or maybe I need different algorithm?

  • \$\begingroup\$ Have you considered a spanning tree algorithm? (See a selection about 3/4 of the way down here) \$\endgroup\$
    – DMGregory
    Jul 14, 2020 at 14:26
  • \$\begingroup\$ I have been looking into Kruskal’s algorithm, Prim’s algorithm, recursive division algorithm, Growing Tree algorithm (weblog.jamisbuck.org/2011/1/27/…) - not sure if it's not same as spanning tree. \$\endgroup\$ Jul 14, 2020 at 14:44
  • \$\begingroup\$ Great! How have you tried putting them into practice? Any specific issues we can help you solve? \$\endgroup\$
    – DMGregory
    Jul 14, 2020 at 14:45
  • \$\begingroup\$ Haven't yet put to practice any other than recursive backtracking. I'm a bit lost now as there is so much algorithms. No idea where to start. \$\endgroup\$ Jul 14, 2020 at 14:49
  • 1
    \$\begingroup\$ So, can you edit your question to clarify what specific step you need our help with? If it's just which algorithm to use, and you have several that look equally-promising in your evaluation, just roll a die and make a start based on that. If you run into a specific problem along the way we can help you solve, edit your question to describe that problem. \$\endgroup\$
    – DMGregory
    Jul 14, 2020 at 16:05


You must log in to answer this question.

Browse other questions tagged .