Hey guys. I've seen a few implementations of L-systems on Processing around, but trying to make a parametric version is being a bit of a pain.
A simple L system is composed of an initial string (an "axiom"), production rules and a resulting string which comes from applying the rules to the current string a bunch of times.
A ruke (on the simple case) just substitutes a character in the current string for a string of characters. Usually these characters are interpreted later as a turtle-graphic code.
So, for example, an L-system with the symbols 'F', '+' and '-', where F makes the turtle move forward (and draw), + and - turn it around. Axiom might be just "F", and the only rule could be "F->F+F". That's a simple case, and in a couple iterations, you would have "F", then "F+F", "F++F+", and so on.
That's a simple case, but you get the idea. It's pretty straightforward to implement on Processing, too.
Now, for parametric L-systems, each character can have some parameters. So, the axiom could be "F(10)", and the rules have conditions on parameters, so for example "F(t):(t>0)->F(t-1)+" and "F(t):(t<=0)->F(10)-" are valid rules.
How would I go about creating those rules I've seen an implementation in JavaScript
here (the parametric system is "Sierpinsky 2"), but in JavaScript functions can be created dynamically as objects (or something like that..), and I can't do that on Processing. So creating a rule to go from F(t) to F(t-1) (and after comparing t>0!) is a bit complicated with the standard string-replacement approach.
I suppose I
could create objects for "syllables", and have these objects create other objects, but then I'd have to hard-code each object and rule, and they consume a LOT more memory than a simple string.
Any ideas