Introducing the L-System

An L-System, also known as Lindenmayer System, is a formal syntax for describing how organisms evolve by way of simple patterns. It was first introduced in 1968 by Aristid Lindenmayer, a Hungarian biologist and botanist. An L-System can generate interesting patterns that mimic real-life shape and form. A well-known example is the growth of a specific algae, which can be modeled as follows:

Axiom: A
Rule: A -> AB
Rule: B -> A

Here is how it works. We always start with the axiom, in this case, the character A. For each generation, we apply the rules to every character in the string. If the character is A, then it is replaced with AB. Similarly, if the character is B, it is replaced with A. Let's work through the first five iterations:

  • A
  • AB
  • ABA
  • ABAAB
  • ABAABABA

You may wonder, how does it even look like an algae? Here's a visualization of the growth from the first generation to the fifth generation:

There are many softwares that can produce interesting graphical visualizations based on L-Systems. An example is My Graphics, an iOS app developed by me. The application can produce several kinds of patterns such as the preceding algae example. An interesting sample called a Koch curve is shown as follows:

Enough said. From what we know so far, the concept is fairly simple. What we are going to do next is design a DSL for the L-System.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.131.72