A general approach to L-systems in Python processing, using layered generators, with a couple implemented. Due to the use of generators they also generate gradually, giving a nice "drawing" effect, rather than blocking for several frames. Basically the beauty of it is that having written all the "library" code, I can define fractals as simply as
sierpinski = LSystemFractal(
"Sierpinski's Gasket",
"F+G+G",
{"F": "F+G-F-G+F",
"G": "GG"},
lambda t, d: standard_rules(t, 120),
lambda d: 2 ** d,
9)
As you can see, it's currently also very easy to read.
Even though I say so myself, the colouring effects are really cool. Not only are
they all rainbow coloured, but the rainbow is extrapolated from the reproduction
rules of each L-system automatically. Basically, when you're only interested in
symbol count, you can use a linear transition matrix and exponentiation by
squaring to calculate the count of each symbol at the n
th iteration in
log(n)
time. This is a totally unnecessary but nevertheless awesome
optimisation to be able to make.
The version used to generate this video is at the video tag.
Here are some screenshots: