Download: Ascii maze generator – 164kb

Screenshot of program output. Click for full size.

Cool, but what’s it do?:
This maze generator will make (for all practical purposes) an infinite number of mazes  you simply choose a width and height (restricted only by the console), and choose a random seed.  A random seed will allow you to create the same maze multiple times, just make sure you enter the same width and height as well.  For example, every time you enter 38 wide 10 high 19 random seed, it will always give you the same maze.  But changing any one of these variables will practically always give you a completely different maze.  Have fun and let me know what you think!

Geek Stuff:
The maze construction works by first setting up a template I put together after studying this then randomly placing blocks onto the maze one by one and ensuring all the maze is accessible, if a piece is placed that would divide any of the maze into a separate section, that piece is removed and a new place is found.  There is a threshold for number of fails and it increases the larger the map gets.  So larger maps do take significantly longer to make than smaller maps.  Additionally, this is not multi-threaded, your single core cpu’s are not at a disadvantage!  That being said, it really doesn’t take very long to crunch a new map.  I would like to eventually export the data to an opengl environment but until then, bask in ASCII’s glory!

(10/08/11) I have updated the program and moved to a different IDE (and compiler) for better compatibility.   The application is now much larger but no worries about an installer or having all the required dlls (yay).  The old build is still available, but you will need Visual Studio C++ installed to run it.  The program is now more efficient at creating larger mazes.  There are actually two fairly similar maze generation algorithms, one is more efficient early on and the other is more efficient as the maze begins to fill up with blocks.  So it starts off with the one, scattering blocks randomly, many times on the same tile as last time and then once I start reaching diminishing returns with the first algorithm a smarter algorithm finishes up, never trying the same block twice.  The difference is really negligible except on huge maps you have to scroll to see (eg. 38×140) but I’m a dork.


One response to “Amazing

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s