Difference between revisions of "Brain Maze"

From Noah.org
Jump to: navigation, search
m
Line 266: Line 266:
 
</table>
 
</table>
  
The mazes generated by this algorithm are made up of these "atmomic" mazes:
+
The mazes generated by this algorithm are made up of the following maze '''atoms''':
  
 
<pre>
 
<pre>
Line 274: Line 274:
 
</pre>
 
</pre>
  
Or more simply (without rotations) these two atoms:
+
This can be simplified by removing rotated copies to these two mazeatoms:
  
 
<pre>
 
<pre>
Line 281: Line 281:
 
     # #    # #
 
     # #    # #
 
</pre>
 
</pre>
Click here to download: [http://www.noah.org/downloadsvn.php?src=file:///home/svn/src/python/brainmaze.py brainmaze.py]
+
 
<include svncat src="file:///home/svn/src/python/brainmaze.py" highlight="python" />
+
Click here to download: [http://www.noah.org/engineering/src/python/brainmaze.py brainmaze.py]
 +
<include src="/home/noahspurrier/noah.org/engineering/src/python/brainmaze.py" highlight="python" />

Revision as of 03:28, 26 March 2010

This is a fractal algorithm I created for generating mazes. I think it's pretty neat. The original was written in C for a computer science class I was taking at UCSC. This version is in Python. The original would print spaces and hashes (#) to display the maze. This version also generates HTML.

This generates a random maze with no loops. It is a spanning tree -- a connected, undirected graph that uses all the vertices in a graph with no cycles.

You can run the brain maze algorithm by clicking here: Generate a Brainmaze

The mazes generated by this algorithm are made up of the following maze atoms:

    # #    ###    ###    ###    # #    ###
    # #    # #      #    #      ###     #
    ###    # #    ###    ###    # #    ###

This can be simplified by removing rotated copies to these two mazeatoms:

    ###    # #
    # #    ###
    # #    # #

Click here to download: brainmaze.py <include src="/home/noahspurrier/noah.org/engineering/src/python/brainmaze.py" highlight="python" />