mazealls {mazealls} | R Documentation |
generate recursive mazes
Description
Generate recursive mazes.
Details
Recursive generation of mazes proceeds roughly as follows: subdivide the domain logicall into two or more parts, creating mazes in the sub-parts, then drawing dividing lines between them with some holes. The holes in the dividing lines should be constructed so that the sub-parts form a tree, with exactly one way to get from one of the sub-parts to any one of the others. Then an optional outer boundary with optional holes is drawn to finish the maze.
unit length
The unit_len
parameter controls the graphical length of one ‘unit’,
which is the length of holes between sections of the mazes, and is roughly the width
of the ‘hallways’ of a maze. Here is an example of using different
unit lengths in a stack of trapezoids
boundaries
The parameters draw_boundary
, boundary_lines
, boundary_holes
,
num_boundary_holes
and boundary_hole_color
control
the drawing of the final outer boundary of polynomial mazes. Without a boundary
the maze can be used in recursive construction. Adding a boundary provides the
typical entry and exit points of a maze. The parameter draw_boundary
is a
single Boolean that controls whether the boundary is drawn or not.
The parameter boundary_lines
may be a scalar Boolean, or a numeric
array giving the indices of which sides should have drawn boundary lines.
The sides are numbered in the order in which they appear, and are
controlled by the clockwise
parameter. The parameter boundary_holes
is a numeric array giving the indices of the boundary lines that should
have holes. If NULL
, then we uniformly choose num_boundary_holes
holes
at random. Holes can be drawn as colored segments with the
boundary_hole_color
, which is a character array giving the color of each
hole. The value 'clear' stands in for clear holes.
Arrows can optionally be drawn at the boundary holes via the
boundary_hole_arrows
parameter, which is either a logical array or a
numerical array indicating which sides should have boundary hole arrows.
end side
The end_side
parameter controls which side of the maze the turtle ends on.
The default value of 1 essentially causes the turtle to end where it
started. The sides are numbered in the order in which the boundary would be
drawn. Along with the boundary controls, the ending side can be useful to join together
polygons into more complex mazes.
Legal Mumbo Jumbo
mazealls is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
Note
This package is dedicated to my friend, Abie Flaxman, who gave me the idea, and other ideas.
If you like this package, please endorse the author for ‘mazes’ on LinkedIn.
Author(s)
Steven E. Pav shabbychef@gmail.com