Spaces:
Running
Running
File size: 1,797 Bytes
87b3b3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
<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>
|