DEV Community

Cover image for On Lindenmayer Systems
João Freitas
João Freitas

Posted on • Edited on • Originally published at joaomagfreitas.link

1

On Lindenmayer Systems

Yesterday I learned about Lindenmayer Systems (L-System) through Gil Durão talk at Flutter Talk Porto 2023. It's a formal specification of a grammar primarly used to model bacteria, algae, plants and tree growth, as originally proposed by Aristid Lindenmayer.

At its core there are three components (G=⟨V,ω,P⟩):

  • An alphabet, which is a list of symbols that can be combined to create strings (e.g., ABC, +-*/), denoted as V.
  • An axiom, which defines the starting point of the L-System (e.g., BC), denoted as ω.
  • A set of production rules, which determine how each symbol of the alphabet is transformed into other symbols (e.g., A -> AB, B -> AC, C -> CB), denoted as P.

The goal behind these systems is to specify finite or infinite strings, which are constructed iteratively by applying the production rules to the symbols from the previous iteration. Using the example above:

  • BC (Axiom - Iteration 0)
  • ACCB (Iteration 1)
  • ABCBCBAC (Iteration 2)
  • ...

Production rules specify the class/type of L-Systems, with the simplest one being D0L-system (deterministic and context-free L-System), which are represented by functions that take symbols as input and deterministically map them to other symbols as output. You can learn more about different classes on this article.


Okay, but what exactly can we use L-Systems for?

While many people use them to generate fractals (because fractals are cool), you can also use L-Systems to leverage your procedural generation game:

Gil prepared a demo of using L-Systems to generate fractals with Flutter. You can check it out here. Also, his presentation is free, so be sure to grab it!

gif of a l-system describing a growing plant

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (2)

Collapse
 
tinygamedev profile image
Tiny

Nice intro post, L-systems are great! This is also the first time I realize Flutter might be a great framework for making games. Any chance you know if the talk you mention is available online somewhere? Your link sends me to a meetup login page.

Collapse
 
freitzzz profile image
João Freitas

The L-System talk is available on Gil GitHub repo: github.com/gildurao/flutter-lsyste...

The other talk was lectured by Renan and it's about Flutter on Android Smartwatches: github.com/renancaraujo/slides/blo...

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay