makeMaze_prim: Create a maze uzing a randomized Prim's algorithm.

Description Usage Arguments Value Examples

Description

Create a maze uzing a randomized Prim's algorithm.

Usage

1
2
makeMaze_prim(gD = NA, stepBystep = FALSE, nrows = 0, ncols = 0,
  inShiny = FALSE)

Arguments

gD

an existing maze graph object.

stepBystep

a flag that will allow a step by step plot of maze creation

nrows

maze hight (number of rows); required only for the step by step plot; default value set to 0.

ncols

maze width (number of columns); required only for the step by step plot; default value set to 0.

inShiny

a flag that marks whether the function is called from a shiny app or console

Value

Given a connected maze graph (with all walls on), this function creates a maze (removes some walls) using depth-first search algorithm (recursive backtracker), and returns the resulting maze graph.

Examples

1
2
3
maze1 <- makeGraph(10, 10)
maze1 <- makeMaze_prim(maze1)
plotMaze(maze1, 10, 10)

Vessy/Rmaze documentation built on May 9, 2019, 9:54 p.m.