Difficulty understanding the concept of writing an L-System?

52 Views Asked by At

I've recently tried my hand at L-Systems, but I'm having some difficulty wrapping my head around it. I watched this video on the subject which is pretty good, but I had a question around the 1:43 mark. He gives a demonstration of how a system would look like given that the axiom is A and the rules are "A-AB" and "B-A". However, when I try to replicate this myself, I face some difficulty.

So here's how I did it:

1. A

Ok, that's an A, so it should become AB

2. AB

There's a B, so at first I thought to change just the B to an A so it would look like AA, but then I realized this would lead to a never-ending chain of A's,

3. ABA

so instead I added the A to the end, which looks like what the video did.

4. ABAAB

Now this is what really confuses me. This is exactly what is shown in the video, but it seems that he added "AB" instead of substituting the last character for it.

Am I missing something, or is he going back-and-forth between replacement and simple addition?

Thank you!

1

There are 1 best solutions below

1
On BEST ANSWER

You need to do all the replacements at once :

$$AB \Rightarrow \overbrace{AB}^A\ \ \overbrace{A}^B = ABA $$

$$ABA \Rightarrow \overbrace{AB}^A\ \ \overbrace{A}^B\ \ \overbrace{AB}^A = ABAAB $$

$$ABAAB \Rightarrow \overbrace{AB}^A\ \ \overbrace{A}^B\ \ \overbrace{AB}^A\ \ \overbrace{AB}^A\ \ \overbrace{A}^B = ABAABABA $$