Quote Originally Posted by boops boops View Post
To make sure there is a good pathway though the maze, I would start by trying to make a single pathway without branches. Start by selecting a random point on one side of the square. Then repeatedly break through a square next to that, disallowing squares already on the pathway. At each step, in other words, you would limit the next breakthrough to a randomly chosen square next to the present one. You continue this until (if you are lucky) you reach a point on another side, such as the opposite side to the starting point.

You will have to keep a count of the squares you have added to the path. If it's less than a certain number, it means the path is too short so you reject that attempt and start again. Probably you should also set an upper limit, to avoid a path which just spirals inwards.

Once you have found a single path, you continue by growing side branches. Select a random point on the existing path and break through to an adjacent square. Probably you probably need to disallow breaking back into the existing path, or only allow it once in so many times. You continue until all the possibilities for branching have been used up.

Would this produce a nice maze? I don't know without trying it.

BB
I tried the Recursive backtracker algorithm @ http://en.wikipedia.org/wiki/Maze_generation_algorithm and it doesn't create a solvable maze... just seems to be random walls, so I tried creating a random path across the grid, which I intended to amalgamate with the random walls created by the Recursive backtracker algorithm. I've just about given up on that idea now. Next i'll try Prim's algorithm