Everything2
Near Matches
Ignore Exact
Full Text
Everything2

How to make a maze

created by m_turner

(idea) by m_turner (1.5 y) (print)   ?   2 C!s I like it! Mon Oct 30 2000 at 5:35:35

Maze generating algorithms are standard CS projects. Using the definition for a maze being there is a single unique path from any point in the maze to any other point.

One of the methods for generating a maze that fits the above definition is to create an NxM grid, with each cell of the grid having a unique number.

+---+---+---+---+
| 1 | 2 | 3 | 4 |
+---+---+---+---+
| 5 | 6 | 7 | 8 |
+---+---+---+---+
| 9 | 10| 11| 12|
+---+---+---+---+
| 13| 14| 15| 16|
+---+---+---+---+
| 17| 18| 19| 20|
+---+---+---+---+

From this, a random wall is selected that has different numbers on either side. This wall is removed. All numbers that are equal to the higher valued number are changed to the lower number. The following example removes the wall between '6' and '7', and then between '3' and '6', and finally the south wall of '2'.

+---+---+---+---+ +---+---+---+---+ +---+---+---+---+
| 1 | 2 | 3 | 4 | | 1 | 2 | 3 | 4 | | 1 | 2 | 2 | 4 |
+---+---+---+---+ +---+---+   +---+ +---+   +   +---+
| 5 | 6   6 | 8 | | 5 | 3   3 | 8 | | 5 | 2   2 | 8 |
+---+---+---+---+ +---+---+---+---+ +---+---+---+---+
| 9 | 10| 11| 12| | 9 | 10| 11| 12| | 9 | 10| 11| 12|
+---+---+---+---+ +---+---+---+---+ +---+---+---+---+
| 13| 14| 15| 16| | 13| 14| 15| 16| | 13| 14| 15| 16|
+---+---+---+---+ +---+---+---+---+ +---+---+---+---+
| 17| 18| 19| 20| | 17| 18| 19| 20| | 17| 18| 19| 20|
+---+---+---+---+ +---+---+---+---+ +---+---+---+---+

At this point, the wall between the two '2's can not be removed, because it has the same number on each side.

This process continues until all of the cells have the value '1'.

+---+---+---+---+
| 1   1 | 1 | 1 |
+---+   +   +   +
| 1 | 1   1   1 |
+   +---+   +---+
| 1   1 | 1 | 1 |
+   +---+   +   +
| 1   1   1   1 |
+   +---+---+   +
| 1   1   1 | 1 |
+---+---+---+---+

See also Kruskal's algorithm for more on the graph theory relating to it.


printable version
chaos

Kruskal's algorithm Solving a maze How to make a woman ejaculate Writing .com files with DOS debug
random number generator Please help us recover your nodes by linking their titles below random insult generator maze
grilled cheese sandwich Vampire Population Ecology WarGames Your last act as a free man should of course be to burn the scrap of paper
Hyrax steganography
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Little presents from the Node Fairy:
Readymade
strawberries
Causa Belli
Dennis the Menace
Sensory metaphors: Colors as nonvisual sensations
surface area to volume ratio
World Trade Center
Heidi Hammel
Pict
Getting to know you noders fucking sucked
Mad Magazine
Guitar Hero
negative nodevertising
New Writeups
teleny
Baron Samedi(person)
Ouzo
The Great Barbershop Race Wars(log)
Mannerisky
second language(essay)
aneurin
British Monomarks(idea)
FrankThomas
How and why do we (humans) have culture?(essay)
lee_cad
Isaac(person)
kalen
downvota(poetry)
Andrew Aguecheek
Wstfgl(thing)
ncc05
overheard at IHOP(event)
calgon
Bottomless(poetry)
lismaraxt
Ice Theory of The Origin of Life(idea)
allthetime
Apple Cinnamon Suicide(idea)
Lucy-S
shovelglove(idea)
Adaptive Child
Mexican secret sauce(recipe)
Adaptive Child
nacho libre(recipe)
E2 is a by-product of the existence of The Everything Development Company