CSharpMaze is my first C# program. Executed from the command-line, you can use it to generate rectangular and circular mazes. Running the command with no arguments, you should get a usage pattern. A random number seed may be provided so that a desired maze can be regenerated with different options. For example, you might generate a solved version and an unsolved version. Following are some example mazes generated by the program.
And here's a circular maze.
For those that may be interested, generating a random maze is actually fairly straight forward, provided your are familiar with basic graph theory and graph algorithms. In terms of graph theory, a maze is simply a random spanning tree of a well connected graph, and there are many ways to go about finding such a tree. The CSharpMaze program strives to choose uniformly from the set of all possible spanning trees of a given graph, which, in the case of CSharpMaze, may take the form of a rectangle or circle. To do this, the disjoint-set-forest data-structure is used. The initial forest consists of all nodes in the given graph, each contained within its own singleton set. Adjacent nodes, randomly chosen and being members of disjoint sets, are then merged into the same set until only one set in the forest remains. Such nodes are not only merged into the same set, but a pathway is also created between them, thereby creating the pathways of the maze.