Building a Maze by Destroying Walls Efficiently
codehowtos.blogspot.com
codehowtos.blogspot.com
[0]: http://lists.canonical.org/pipermail/kragen-hacks/1999-Febru... "mazewiz in C (second iteration), posted to kragen-hacks 1999-02-16"
Joe Allen's three-lines-of-C maze generator (included in the post), however, blows the hell out of my program for coolness.
That does however mean that it's a 237 character maze generator, which is still pretty cool.
cd ai4u-read-only/com.ai4u.util/trunk/src
javac com/ai4u/util/*.java com/ai4u/util/disjointSet/*.java com/ai4u/util/games/maze/Maze.java
java com.ai4u.util.games.maze.Maze
I like the output of this maze algo even more than the standard recursive backtracker, plus it's more efficient; from a few walkthroughs it seems to generate slightly more challenging mazes as well. (A solver line would help showing this and any bias.)Also to make more fun (Maze.java):
final int rows, cols;
if (args.length == 2) {
rows = Integer.parseInt(args[0]); cols = Integer.parseInt(args[1]);
} else {
rows = cols = 30;
}
final Maze m = createRandomMaze(rows, cols);
...
.addGap(0, 13 * cols,
...
.addGap(0, 13 * rows,