holey_line {mazealls} | R Documentation |
holey_line .
Description
Draws a line with a randomly selected ‘hole’ in it.
Usage
holey_line(unit_len, num_segs, which_seg = NULL, go_back = FALSE,
hole_color = NULL, hole_arrow = FALSE)
Arguments
unit_len |
the unit length in graph coordinates. This controls the width of the ‘holes’ in the boundary lines and generally controls the spacing of mazes. |
num_segs |
the total number of segments. All but one of these,
of length |
which_seg |
optional numeric indicating which segment should
have the hole. If |
go_back |
whether to return the turtle to starting position when the line has been drawn. |
hole_color |
the color to plot the ‘hole’. A
|
hole_arrow |
a boolean or indicating whether to draw a perpendicular arrow at a hole. |
Details
This function is the workhorse of drawing mazes, as it creates a maze wall with a single hole in it.
Value
Returns the which_seg
variable, the location of the hole, though typically
the function is called for side effects only.
Author(s)
Steven E. Pav shabbychef@gmail.com
Examples
library(TurtleGraphics)
turtle_init(1000,1000,mode='clip')
turtle_hide()
y <- holey_line(unit_len=20, num_segs=15)
turtle_right(90)
y <- holey_line(unit_len=20, num_segs=10,hole_arrow=TRUE)