Spaces:
Running
Running
<h2>Maze generators</h2> | |
<p>This family of algorithms uses the following callback values:</p> | |
<ul> | |
<li><code>0</code>: empty space</li> | |
<li><code>1</code>: wall</li> | |
</ul> | |
<h3>DividedMaze</h3> | |
<p>Based on a <a href="http://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_division_method">Recursive division method</a>.</p> | |
<div class="example"> | |
var w = 39, h = 25; | |
var dm = new ROT.Map.DividedMaze(w, h); | |
for (var i=0; i<4; i++) { | |
var display = new ROT.Display({width:w, height:h, fontSize:6}); | |
SHOW(display.getContainer()); | |
dm.create(display.DEBUG); | |
} | |
</div> | |
<h3>Icey's Maze</h3> | |
<p>Cool mazes with a configurable regularity can be created using this <a href="http://www.roguebasin.roguelikedevelopment.org/index.php?title=Simple_maze#Maze_Generator_in_Visual_Basic_6">algorithm</a>, | |
taken from a Rogue Basin wiki. Regularity is an integer value, specified as a third argument; 0 = most random.</p> | |
<div class="example"> | |
var w = 39, h = 25; | |
for (var i=0; i<4; i++) { | |
var display = new ROT.Display({width:w, height:h, fontSize:6}); | |
SHOW(display.getContainer()); | |
var maze = new ROT.Map.IceyMaze(w, h, 4*i); | |
maze.create(display.DEBUG); | |
} | |
</div> | |
<h3>Eller's Perfect Maze</h3> | |
<p>For a full explanation of this wonderful Eller's algorithm, please see | |
<a href="http://homepages.cwi.nl/~tromp/maze.html">http://homepages.cwi.nl/~tromp/maze.html</a>. | |
Not only it generates a <em>Perfect maze</em> (every two cells are connected by exactly one path), | |
but it only requires 2*N memory to generate a maze of N*N size!</p> | |
<div class="example"> | |
var w = 39, h = 25; | |
var em = new ROT.Map.EllerMaze(w, h); | |
for (var i=0; i<4; i++) { | |
var display = new ROT.Display({width:w, height:h, fontSize:6}); | |
SHOW(display.getContainer()); | |
em.create(display.DEBUG); | |
} | |
</div> | |