Here is a sample of my new maze generation routines, the code is inspired in manual pages of xscreensaver's mace (by various authors) Is posible to reach every part of the map. Warning!: This is badly written C code, long periods of exposition to this material will give neural damage. int maze_level (int level) { int i,j,k=0; coord hedges[731+1]; /* Dirty hack!!! SHOULD BE CHANGED! to use defines*/ /*Use de +1 as a buffer to swap values*/ int group[(LEVELWIDTH-2)*(LEVELHIGHT-2)/4]; /*now,390*/ /* fist i create the stairs*/ i=myrand((LEVELWIDTH-2)/2);i=i*2+1; j=myrand((LEVELHIGHT-2)/2);j=j*2+1; clear_tile (i,j,level,'>'); while (map[i][j][level]=='>') { i=myrand((LEVELWIDTH-2)/2);i=i*2+1; j=myrand((LEVELHIGHT-2)/2);j=j*2+1; } clear_tile (i,j,level,'<'); /* carve basic holes */ for (i=1;iLEVELWIDTH-2 || hedges[i].y>LEVELHIGHT-2) die ("Maze generation, Hedge coords"); if (hedges[i].y%2) { j=((hedges[i].x-2)/2)+(((hedges[i].y-1)/2)*39); k=j+1; if (group[j]!=group[k]) { unitegroups(group[j],group[k],group); if (myrand(20)) { clear_tile (hedges[i].x,hedges[i].y,level,'.'); } else {make_door (hedges[i].x,hedges[i].y,level);} } } else { j=((hedges[i].x-1)/2)+(((hedges[i].y-2)/2)*39); k=j+39; if (group[j]!=group[k]) { unitegroups(group[j],group[k],group); if (myrand(20)) { clear_tile (hedges[i].x,hedges[i].y,level,'.'); } else {make_door (hedges[i].x,hedges[i].y,level);} } } } return 1; } void unitegroups(int j,int k,int * group) { int i,l; l=min(j,k); /*Debug*/if (k>389 || j>389) die ("Maze generation, unitegroup"); for (i=0;i<((LEVELWIDTH-2)*(LEVELHIGHT-2)/4);i++) { if (group[i]==j|| group[i]==k) group[i]=l; } } This is a smaple ouput ################################################################################ #.......#.......#.......#.'.......#.....#.......#.#.#.........+.#...#.....#.#.## ###.#.#####.#.#.#####.###.###########.###.#.#####.#.###.#######.#.#.#####.#.#.## #...#.#.+...#.#...#.....#.#.........#.....#.+.#.......#.#.#.#.....#.......#.#.## #.#.#######.#####.#####.#.#####.###.#######.###.#####+#.#.#.#.#.#######.#.#.#.## #.#.......#...#.........#.#...#...#.........#.#...#...#...#...#.#.......#.....## #.#####.#####.#.#.###.###.###.#.#####.#######.#+#.###.#.###.#######.###.###.#### #.....#...#...#.#.#.........#...#.#.....#.#.....#.#...#.#...#...#.....#.#.....## #####.#+#########.#.#######.#.###.#.#####.###.#######.###.#####.################ #...#.#.#...#...#.#.#...#.......#.....#...#...#.#.#...#.#.........+.#.........## #.#.###.#.#.#.###.###.#.###.#.#.#.#.#.###.###.#+#.###+#.#.#########.#.#####.#### #.#.......#.#.....#.#.#...#.#.#.#.#.#.#...#.#.....#.....#...#<..........#.....## #.#.#####.#####.#.#.#####.###.#########.###.#.#.#########.#####.#######.#####.## #.#.#.#.#.......#.#...#.#.#.....#.......#.....#.......+.#.+.#...#.........#...## #.###.#.#.#####.###.###.#+#####.#.#.###.#.#.#+#.###.###.#.###.#.#######.#.#.#### #.#.....#.#...#.............#..>#.#.#.....#.#.#...#.#.......#.#.#...#...#.#...## #.###.#.#+#.#####.#.###.#####.###.#######.#####.#.#.#######.#.#####.#######.#.## #.#.#.#.......#...#...#.#.#...'.....+.#.#.....#.#.#.......#.#.#.#...#.#.....#.## ###.###+#####.#######.#.#.#.#####.###.#.#####.###.#########.#.#.#.###.###.###.## #.......#...........#.#...#.....#...#.....#...#.........#...#...........#...#.## ################################################################################ ################################################################################