Sign in to follow this  
ponja

Maze generation algorithm for specified parts

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 this post


Link to post
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)

What your music could control:
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.
classic music -> jump to the closest valid cell
electronic -> jump to a cell with big space around it

Have fun!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this