R: Rewrite an Axiom Using Production Rules to Give a String...
Lsys
R Documentation
Rewrite an Axiom Using Production Rules to Give a String Ready for Turtle Graphics
Description
This is the central function for rewriting an initial string of symbols (the axiom)
into a new string using production rules. Production rules are very simple: if
the symbol is A, turn it into something. If it is B, turn it into something else.
Production rules typically contain instructions about moving while drawing,
moving w/o drawing, changing direction, or storing the current state for re-use later.
A character string giving variables (symbols) to use as the initial string
Also known as the axiom.
rules
A data frame containing columns "inp" and "out". These contain the input
variables and the corresponding replacement string. See the examples in
drawLsys.
n
An integer giving the number of cycles or iterations desired.
retAll
Logical. If TRUE, the result at each cycle will be returned,
otherwise only the last result is returned.
verbose
An integer giving the level of information desired as the calculation
proceeds. verbose = 1L gives basic information at each cycle.
Any value greater than 1 gives much more detail. Supress messages by using a value
less than 1.
Value
If retAll = FALSE, a character vector of length 1 giving the string
at the end processing. Otherwise, a character vector of length n + 1
containing init plus the results at the end of each iteration.