The classes of this package form the building blocks of the maze creation tool irrGardener.
There are classes with different purposes. The main categories are:
In this category there are classes which describe how mazes are build. All maze types provided by this program have in common that they
All mazes have to implement the {@link de.caff.maze.Maze} interface, and at the moment all implemented mazes even extend {@link de.caff.maze.AbstractBasicMaze}. The mazes implemented are:
As said all mazes consist of cells which have to be extensions of {@link de.caff.maze.MazeCell}. Because MazeCells provide knowledge which cells are their neighbours the creation of a maze can be abstracted. After the creation is finished the knowledge which cells are connected is enough abstraction to find a way from one cell to any other
The maze cell abstraction described in the previous paragraph is enough to allow creation and solving indepently from the maze type. Both algorithms are implemented in {@link de.caff.maze.MazeTool}.
The algoritm for maze creation is based on the fact that each maze cell belongs to a set. In the very beginning (when no cells are connected), each cell is in a set of its own. Now the algorithm picks a cell and a neighbour of it randomly, connect them and unite their sets, so that they are in the same set (now containing 2 cells). It goes on doing so, but now two things can happen:
At a given point (when various cells are already connected, but still not all) the algorithm is changed because selecting a cell and a neighbor at random now quite often result in point 2 above: they are already in the same set, so nothing happens and the random choice has to start again. Instead a set is chosen randomly, and starting from a random cell in the set the algorithm looks for a neighbour which does not already belong to the current set. In this case the neighbour is connected, both sets are united and everything starts again: choose a set at random, start for a random cell and look for unconnected neighbors...
Mazes of the same type can have different properties like number of cells (often determined by a number of horizontal and a number of vertical cells) and other geometric properties. And all mazes can be painted differently (colors, linestyle).
To handle the first kind of properties a has a collection of {@link de.caff.maze.PropertyInformation}s which tell which properties are defined and know how to provide a setter for each setable property. There are various implementations including {@link de.caff.maze.AbstractPropertyInformation} and several inner classes of {@link de.caff.maze.MazePropertyOwner}.
The second kind of properties are handled by the {@link de.caff.maze.MazePaintProperties} interface and the extending interface {@link de.caff.maze.MazePrintProperties} and their implementations like {@link de.caff.maze.MazePaintPropertiesProvider} and {@link de.caff.maze.MazePrintPropertiesProvider}.
Because the program shall be runnable as an application, an applet (currently not implemented) and via Java Web Start it's helpful to abstract from the underlying system to allow preference saving and restoring, saving and loading of mazes and printing.
The underlying system is abstracted by {@link de.caff.maze.DataStorage} (for access to preferences) and the extending interface {@link de.caff.maze.SystemAccess} which adds access to the printer and files. Implementation of the former are {@link de.caff.maze.FileDataStorage} (saving preferences to a file) and {@link de.caff.maze.TemporaryDataStorage} (which does store preferences only internally during the runtime of the program to provide a fallback). The latter has implementations {@link de.caff.maze.ApplicationSystemAccess} (standard access when running as an application), {@link de.caff.maze.JnlpSystemAccess} (system access via JNLP/Java Web Start) and {@link de.caff.maze.NullSystemAccess} (which does not access any system, acting as a fallback).
Most of the classes not mentioned yet fall are Swing classes which are used to pack everything together:
Finally there are some helpers: