Back to Works

L-System Generator

Formal Grammar & Recursive Geometries: A Python-based PCG Study

The Technical Concept

This system implements an L-System (Lindenmayer System) generator and visualizer utilizing Python and the Dear PyGui framework. By interpreting recursive string production rules through Turtle Graphics logic, the application synthesizes complex geometric structures ranging from rigid fractals to organic, stochastic branching patterns.

Mathematical Derivation & Logic

Grammar Parser

Custom iterative string rewriting engine that handles Axiom and Production Rules with optimized memory allocation for deep recursions.

Turtle Interpreter

Interprets strings into geometric commands (position, heading, and state stacking) rendered in real-time within a high-performance GUI.

Formal Logic Derivation

Mathematical Derivation of L-System

Figure 1: Production rules and string rewriting logic.

Project Highlights

  • Parametric Control: Real-time adjustment of axioms, production rules, iterations, and geometric angles via GUI.
  • Stochastic Functions: Incorporation of random variations to simulate natural, organic growth patterns.
  • Fractal Extension: Capability to generate classic fractals such as the Koch Snowflake and Sierpinski patterns.