To install the Rmaze package, run the following command:
devtools::install_github("Vessy/Rmaze")
library("Rmaze")
Rmaze is a package that provides options to generate and plot mazes in R.
Currently, the package provides options to create a maze using the recursive backtracker (modified depth-first search), Kruskal's, and Prim's algorithms. These algorithms create "perfect" mazes, i.e., mazes without loops and without inaccessible areas. Such mazes have exactly one solution (there is exactly one path from each maze cell to another maze cell).
All mazes are represented in a form of connected graphs, where the edges represent possible wall sites and the nodes represent maze cells. All graph manipulations are based on the functions provided in the igraph package.
The package also provides options to plot step-by-step maze generating process and the maze solution.
The maze solution is defined as the shortest path between the start and end maze cells:
Finally, the package provides an option to create imperfect mazes. These mazes are created by randomly adding or removing specified percentages of maze walls from the perfect mazes. In the process of randomization, the algorithm ensures that the added and removed walls do not interfere with the existence of the maze solution. The imperfect mazes contain loops, inaccessible areas, and may have more than one solution.
To run a Shiny app showcasing the basic Rmaze features, run the following command:
Rmaze::runExample()
To report a bug, problem, or question, please open an issue.
To learn more about mazes, see:
http://www.jamisbuck.org/presentations/rubyconf2011/index.html
http://weblog.jamisbuck.org/2011/2/7/maze-generation-algorithm-recap
http://www.astrolog.org/labyrnth/algrithm.htm
https://en.wikipedia.org/wiki/Maze_generation_algorithm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.