Lindenmayer Systems, or L-Systems:
Take a string as a set of instructions in turtle graphics. “L” means “turn left”, “R” means “turn right”, and “F” means “go forward”.
Now imagine starting with a string “A” and a set of rules. You replace the characters in this string according to the rule a fixed number of times. Then for every type of character, you can either replace it with one of “L
“, “R
“ or “F
“, or ignore/remove it.
For example, suppose you have one rule,
and a final rule
In this example, it takes 12 or 12 turns to turn completely around.
We start with and apply the rule to get . We apply the rule again to get , and so forth. In my example, I stopped when I got a string that would have 5000 forward moves in it.
Here's what it looks like:That’s one continuously traced path, all thanks to string rewriting. I’ve also created a page with a large number of random rules. It takes a lot of memory because of all the thumbnails, but if you’re curious about the rules used to generate a shape, simply follow the link to the SVG and “view source” to see what generated that shape.