Help

An L-System is a rule-rewriting system. Starting with a pattern of symbols (an "axiom"), symbols are replaced according to a set of rules repeatedly for n iterations. Certain symbols are interpreted as drawing commands.

Write a set of rules, and a starting axiom. An axiom is a pattern without an arrow.

If a rule has an associated probability, it will be applied randomly. A symbol can have multiple rules with different probabilities.

Rule syntax (PEG):

Rule:         Symbol Probability? Arrow Pattern
Symbol:       !Arrow .
Probability:  "(0." [0-9]+ ")"
Arrow:        "→" | "->"
Pattern:      Symbol*
    

Symbols can be any character. These symbols have special meaning, controlling the pen:

FMove forward, drawing a line
fMove forward without drawing a line
+Rotate left by δ degrees
-Rotate right by δ degrees
[Push the drawing state onto a stack
]Pop the drawing state stack