LsL-system

Procedural · Scale 4

L-system

An L-system is a rewriting rule applied to its own output, again and again. A turtle, a pen that only moves forward and turns, draws the result.

What it is

An L-system starts with a short string of symbols and a rule that replaces each symbol with a longer string. The rule is applied to its own output a set number of times, and that number is the depth. A turtle then reads the final string and draws it. A turtle is a pen that only moves forward and turns.

The rule on these plates grows a branching tree. The Hilbert curve can also be written as a rewriting rule, and it has a cell of its own. See the Space-Filling Curve cell →

The plates

Five plates, at depths 2 to 6. Start with one growing tip. The rule: every stem doubles in length, and every tip becomes a short stem, a side shoot to the left, a side shoot to the right (each turned 44 degrees) and a longer stem ending in a new tip. The pen walks forward, turns, and steps back to the last fork.

Safari stop · Branching · Depth
  • depth 2

  • depth 3

  • depth 4

  • depth 5

  • depth 6

Turn the dial on the safari →

Each line is cut where it crosses the outline of the word. The parts inside the word are drawn heavier.

The plates are drawn by mosaic, a small Python library of our own, built on numpy, scipy, shapely and contourpy. No image model is involved, and each plate is a flat-colour SVG under 45 KB. The word Ciao is the safari's constant: it sits in the same place on every plate.

What we did and found

The rewriting and the turtle are our own code, about 25 lines.

At depth 7 the tree no longer fits the 45 KB plate limit. The dial on the safari stops at 6.

What is open

One rule has been drawn in this cell. Depth 7 of the tree does not fit a plate as plates are written now, and we have not tried to make it fit.

mosaic is not yet part of Platypus, our visuals engine. That is why this cell is marked as working and not as shipped: the page is our notebook on the element.

Composes with

Other cells in the table — most still to be walked into in coming sessions.