You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I stumbled across this repo in search of maze algorithm implementations. I tried translating your code to Lua but I could not get the algorithm to work. For whatever reason, the algorithm would only generate zigzag patterns with a few joining cells...
Since then, I stumbled across the Aldous-Broder algorithm which you may find useful. The algorithm is the following:
// semi-pseudocode (translating from Lua to JS-like)varvisited=newSet();functionvisit(cell){cell.isVisited=truevisited.add(cell)}functionhasUnvisitedCells(){returnvisited.size<numberOfColumns*numberOfRows}functiongenerate(){varcell=this.getRandomCell()visit(cell)while(this.hasUnvisitedCells()){varneighbor=cell.neighbors.shuffle().first()if(!neighbor.isVisited){cell.connect(neighbor)this.visit(neighbor)}cell=neighbor}}
Cheers!
The text was updated successfully, but these errors were encountered:
Hello,
I stumbled across this repo in search of maze algorithm implementations. I tried translating your code to Lua but I could not get the algorithm to work. For whatever reason, the algorithm would only generate zigzag patterns with a few joining cells...
Since then, I stumbled across the Aldous-Broder algorithm which you may find useful. The algorithm is the following:
Cheers!
The text was updated successfully, but these errors were encountered: