# Maze generation algorithm for specified parts

This topic is 3968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am an undergraduate student studying mechanical engineering. We are doing a project called the labyrinth cutter, we're constructing a piece of artwork consisting of a a gantry connected to a cutter head. The cutter is supposed to cut out a labyrinth to a piece of music. I decided to use the midi file of the music piece to create straight parts with certain lengths. At various beats the labyrinths changes direction. I used Java with J-music to do this and came out with 400 pieces that now have to be placed in a certain order to create a labyrinth. The lenghts of the pieces depend on the frequency of the note being played and the time between pieces. I wrote a program in c++ that uses recursive backtracking, simply trying to place piece after piece and see if it fits. Currently up to about 150 pieces is doable but after this the computation time gets way to heavy. I am wondering if anybody has an idea of a certain algorithm that could be used to solve this or point me in the right direction a bit as I'm not quite sure what I can do right now except for reducing the amount of pieces. Picture shows a solution with 150 pieces, obviously this won't fill the area. http://img89.imageshack.us/my.php?image=labyyc7.jpg Also if you have another idea of how to represent the labyrinths creation as being done to the piece of music please state your idea.

##### Share on other sites
To build a maze:
1) start from any cell
2) move in a direction, until you reach a wall or some random condition is true
3) try rotate left or right, if there is some space left
4) jump to a cell with some unvisited neighbor and break the wall between them
5) go to point 2)

1) the random probability of rotating left or right, e.g.
fast music -> low probability to turn
melodic -> high probably to turn right
dark -> high probably to turn left
2) which cell you jump on (the order may lead to very different results), e.g.

Have fun!

1. 1
2. 2
3. 3
Rutin
25
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633650
• Total Posts
3013119
×