Maze Generator
This is a piece of python code that has the ability to generate massive mazes. (I created it on the 13th of June 2013 as a one-day project - I was curious as to how big a maze I can get) The algorithm requires extreme depths of recursion, amounts beyond what Python can handle, so I had to bypass this problem by creating my own stack and writing the content of it onto the disk when it became too large.
For extremely large mazes, the program has the ability to cut the maze up into sectors to avoid running out of memory, yet keeping the currently active sectors in the RAM.
Code:
- The code can be found in a git repository here.
Sample output
- 30 by 30 - A small maze (takes less than a second to generate)
- 500 by 500 - This size took about 5 seconds to generate
- 3 000 by 3 000 - This size took about 30 seconds to generate
- 10 000 by 10 000 -
Largest maze I dared generate so far.It took about 30 minutes to complete and reached a maximum recursion depth of around 5 045 000. (GIMP can still open it fairly well) - 20 000 by 20 000 - After a search of the internet I found that the largest maze out there that can be easily found and downloaded was 10 001 by 10 001 pixels. Being beaten by a single pixel is not something I was prepared to accept. ; ) Watch out, it can take a while to open this image. It took 2 hours to generate and reached a maximum recursion depth of around 22 470 000.
All links from the CV