L-System Simulations
eliben.github.io
eliben.github.io
here is the grammar:
Pattern Production :
0123456789 draw a line
[ push turtle state
] pop turtle state
+ turn angle
- turn -angle
* scale direction and distance up
/ scale direction and distance down
b brighten
d darken
c hue color -1
C hue color +1
[ABD-Z][ae-z] variables for patterns rewriting Alphabet : A, B
Constants : F + −
Axiom : A
Production rules:
A → +BF−AFA−FB+
B → −AF+BFB+FA−
I thought it might be: A=|+[B]|−[A]|[A]-|[B]+
B=|−[A]|+[B]|[B]+|[A]−
but that doesn't work, and I don't know what's wrong.Here's a version in Go instead: https://github.com/deosjr/GenGeo/blob/master/gen/lindenmayer... Which renders into: https://github.com/deosjr/GenGeo/blob/83c77f9433e569b30f71b3... (see Algorithmic Beauty of Plants for way more examples)
axiom: a
rules:
a = +b|-a|a-|b+
b = -a|+b|b+|a-
initial angle: 90
angle change: 90
scale: 1
simulation depth: 4
(I've been working on basic space-filling curves, and came across that Wikipedia page last week, which is about all I know about L-systems.)
I while back i was trying to come up with interesting rules to generate fractals and em up creating a genetic algorithm with you as the evaluator.