**I have generated maze using dfs. I followed this alogorithm
create a CellStack (LIFO) to hold a list of cell locations
set TotalCells = number of cells in grid
choose a cell at random and call it CurrentCell
set VisitedCells = 1
while VisitedCells < TotalCells
find all neighbors of CurrentCell with all walls intact
if one or more found
choose one at random
knock down the wall between it and CurrentCell
push CurrentCell location on the CellStack
make the new cell CurrentCell
add 1 to VisitedCells
else
pop the most recent cell entry off the CellStack
make it CurrentCell
endIf
endWhile
Now I need to generate a Tilt/Turn Maze in which you can turn the maze left or right. Once you turn the maze , ball will start falling due to gravity until it hits a barrier. There is no way you can stop the ball in middle of its fall.
what I have found till now is few maze designs but nothing on tilt/turn maze generation algorithm.
what I have tried -
Take a grid of nxn
take a start point for ball.
take a end point (hole).
fill the remaining cell of maze with blocks.
while (ball do not reach the hole){
randomly turn the maze to left or right
take a random fall
remove the blocks in path
}
它适用于小型迷宫,但对于较大的迷宫,它会进入无限循环(堆栈溢出) 如何在相同的网格尺寸中增加和减少此迷宫的复杂性。 **