Almost done with an l-system
Well, should have been writing or at least working on CuteGod. But, I had to get my L-system mostly working and now it is. Apparently, I accidentally got contextual working in the process of doing parametric ones. So, I bet you are wondering what is the difference? No, didn't think so.
Gonna write about it anyway.
The basic l-system is a bunch of variables, constants, and rules. They have the initial state (axiom) which indicates where we start.
Variables: A, B.
Constants: None.
Rules: (A -> AB, B -> A)
Axiom: A
This initial mess starts with "A" and every generation replaces the "A" with "AB" and the "B" with "A".
- Generation 0: A
- Generation 1: AB
- Generation 2: ABA
- Generation 3: ABAAB
A parametric l-system gives you a bit more information, specifically parameters to your values.
Variables: K.
Constants: None.
Rules: (K(n) -> K(n + 1))
Axiom: K(0)
This system increments K(n) by one every time you get it.
- Generation 0: K(0)
- Generation 1: K(1)
- Generation 2: K(2)
- Generation 3: K(3)
One of the features I saw was the ability to take a parametric and use some comparison to show the rise and fall of something. Or, what I have in mind, leaf and flower sizes.
Variables: Leaf, Flower.
Constants: None.
Rules: (Leaf(2) -> Flower(0), Leaf(n) -> Leaf(n + 1), Flower(n Flower(n + 1))
Axiom: Leaf(0)
What this does is start with Left(0) and increment it until we get Leaf(2), then replace it with a Flower(0) which grows until you get Flower(2). I can use that to show a tree, have the tree branch off into twigs, have leaves grow on the twigs and gets some flowers, then have the flowers die and the leaves turn colors before falling off, then in the next year branch it off some more.
- Generation 0: Leaf(0)
- Generation 1: Leaf(1)
- Generation 2: Leaf(2)
- Generation 3: Flower(0)
- Generation 3: Flower(1)
- Generation 3: Flower(2)
- Generation 3: Flower(2)
Complicated, huh? It seems like an interesting system for creating "dynamic" cities, trees, and other stuff for Ponies Among Us and maybe Cute God, though I doubt it. I don't have much left to do on the library until I can call it "alpha". Mainly comparisons, ie. "Flower(n < 2)", and probabilities. The latter will take about 5-10 minutes, the former probably an hour then I'm "done" for now on the library.
Didn't get much biking as I planned. My bosstype asked me to stay late to babysit the guy putting in the Internet connection, so I had to catch a ride instead of biking. My goal isn't looking too good, unless I make a point of biking on the weekend, which I rarely do.
Summer Biking: (357.2 of 400.0 km)
Metadata
Categories:
Tags: