From the NannyMUD documentation

LAST CHANGE

2004-06-06

NAME

        maze_gen - A maze generator.

INCLUDES

        maze.h

LOCATION

        /std/special/maze_gen/maze.c

FUNCTIONS

QUERY FUNCTIONS

        get_maze
        get_map

DESCRIPTION

        The maze generator produces rectangular random mazes. Each
        cell in the maze is represented as an integer in which
        exits from the cell are stored. The directions are
        represented as bits, and the values are bitwise or'ed
        together. The directions are given as if the maze was
        written on a paper:

        direction   binary   decimal
        left        1000     8
        down        0100     4
        righ        0010     2
        up          0001     1

        Thus, a cell with value 10 has exits 'up' and 'down', and
        a cell with all four exits would have the value 15.

        There are two different algorithms available for
        generating the maze. One is the common 'depth-first', and
        the other is Prim's method. The former gives labyrinths
        with long corridors and little forking, while the other
        doesn't.

        There is an example of using the maze generator in the
        dir /std/special/maze_gen/example
        which might be instructive to read.
        

FUNCTION


NAME

        get_maze - Get a generated maze.

SYNTAX

        mixed get_maze(int rows, int cols, int method)

DESCRIPTION

        This function is used to get a maze. It returns an array
        of array of integers, specifying how the rooms in the maze
        are connected.

        The argument 'rows' and 'cols' specify the size of the
        maze. The 'upper left' (or most north-west) corner will be
        at position (0,0), and the 'lower right will be at
        position (rows-1, cols-1).

NOTE

        To keep down the CPU usage and avoid causing lag, the
        generated mazes are limited in size. The limits can be seen in
        the include file, maze.h.

NOTE

        Few things can be as boring as an empty maze. Good mazes takes
        a real effort to create.

FUNCTION


NAME

        get_map - 2D map of a maze

SYNTAX

        string get_map(mixed map)

DESCRIPTION

        This function returns a simple picture of the given map.