{
 "id": "l-systems",
 "title": "L-Systems",
 "aliases": [
  "Lindenmayer systems",
  "turtle-graphics plants",
  "parametric L-systems"
 ],
 "domain": "procgen",
 "subdomain": "plants and vegetation",
 "stage": "procedural",
 "realtime": "realtime",
 "platforms": [
  "cpu",
  "webgl2",
  "webgpu",
  "blender",
  "houdini",
  "unity",
  "unreal",
  "godot",
  "python"
 ],
 "year_introduced": 1968,
 "inputs": [],
 "outputs": [
  "curves",
  "mesh",
  "graph"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "Parallel string-rewriting grammars whose output symbols are interpreted by a turtle to draw branching structures. Parametric, stochastic and context-sensitive variants model plant development.",
 "how_it_works": "An L-system consists of an alphabet, an axiom and productions applied to every symbol simultaneously in each generation, so growth is parallel like cell division. After n generations the string is interpreted by a turtle: F moves forward and draws a segment, + and - turn, [ and ] push and pop turtle state to create branches. Parametric versions attach numeric parameters (length, thickness, age) to symbols and condition productions on them, stochastic versions pick productions by probability, and context-sensitive versions let neighbours influence a rewrite so signals can travel along the plant. Open L-systems exchange information with an environment, enabling effects like phototropism or pruning. The Algorithmic Beauty of Plants gives the canonical treatment and examples.",
 "when_to_use": "Choose it for trees, ferns, flowers and fractal curves where the developmental rules are the creative control, and for architecture-style recursion. Prefer `space-colonization-trees` when branches should fill a volume or follow an attractor shape with minimal parameters, `climbing-plants-simulation` for vegetation interacting with geometry, and `cga-shape-grammar` for building facades.",
 "cost": {
  "class": "cheap",
  "notes": "String length grows exponentially with generations for branching rules, but typical plants need under 10 generations; meshing the result dominates."
 },
 "failure_modes": [
  "Exponential string growth blows memory and time for deep derivations",
  "Turtle interpretation produces self-intersecting branches that require explicit collision handling",
  "Context-free rules look rigidly symmetric unless stochastic or parametric randomness is added",
  "Tuning production parameters is non-intuitive: tiny changes give wildly different plants",
  "No built-in environment awareness: trees ignore walls, light and neighbours unless open L-systems are used"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://algorithmicbotany.org/papers/abop/abop.pdf",
   "type": "web",
   "title": "The Algorithmic Beauty of Plants",
   "authors": [
    "Przemyslaw Prusinkiewicz",
    "Aristid Lindenmayer"
   ],
   "year": null,
   "venue": "algorithmicbotany.org",
   "url": "https://algorithmicbotany.org/papers/abop/abop.pdf",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261021221844/https://algorithmicbotany.org/papers/abop/abop.pdf",
     "timestamp": "20261021221844"
    },
    "page_title": null,
    "host": "algorithmicbotany.org",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://algorithmicbotany.org/papers/abop/abop.pdf → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://algorithmicbotany.org/papers/abop/abop.pdf → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "prusinkiewiczalgorithmic"
  },
  {
   "role": "tutorial",
   "key": "url:http://paulbourke.net/fractals/lsys",
   "type": "tutorial",
   "title": "L-System User Notes",
   "authors": [
    "Paul Bourke"
   ],
   "year": null,
   "venue": "paulbourke.net",
   "url": "https://paulbourke.net/fractals/lsys",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261011215217/https://paulbourke.net/fractals/lsys/",
     "timestamp": "20261011215217"
    },
    "page_title": "L-System manual",
    "host": "paulbourke.net",
    "title_confirmed_by_page": false,
    "title_unconfirmed": true
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET http://paulbourke.net/fractals/lsys → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET http://paulbourke.net/fractals/lsys → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0.5714285714285714,
   "__bib": "bourkesystem"
  }
 ],
 "presets": [
  {
   "id": "l-systems-specimen",
   "title": "Dragon curve drawn from an L-system rewrite (512 turtle segments)",
   "runtime": "glsl-fragment",
   "params": {
    "SEGS": 512,
    "UNIT": 0.028
   },
   "code": "// Dragon curve as an L-system (F->F+G, G->F-G), 512 turtle segments; turn direction of step k read off the rewrite by its bit pattern.\nconst int SEGS = 512;\nconst float UNIT = 0.028;\nconst vec2 CENTER = vec2(0.5, 0.5);\nfloat segd(vec2 p, vec2 a, vec2 b) {\n    vec2 pa = p - a, ba = b - a;\n    return length(pa - ba * clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0));\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    vec2 pos = vec2(0.0), dir = vec2(1.0, 0.0);\n    vec2 origin = CENTER - UNIT * vec2(8.0, 5.5);\n    float best = 1e9, bi = 0.0;\n    vec2 a = origin;\n    for (int k = 1; k <= SEGS; k++) {\n        vec2 b = a + dir * UNIT;\n        float d = segd(uv, a, b);\n        if (d < best) { best = d; bi = float(k) / float(SEGS); }\n        a = b;\n        int m = k;\n        while ((m & 1) == 0) m >>= 1;\n        dir = ((m & 3) == 1) ? vec2(-dir.y, dir.x) : vec2(dir.y, -dir.x);\n    }\n    vec3 bg = mix(vec3(0.04, 0.05, 0.09), vec3(0.09, 0.08, 0.14), uv.y);\n    vec3 lc = 0.5 + 0.5 * cos(6.2831 * (bi * 0.9 + vec3(0.0, 0.33, 0.67)));\n    float w = smoothstep(0.0042, 0.0016, best);\n    vec3 col = bg + lc * w + lc * 0.12 * smoothstep(0.02, 0.0, best);\n    fragColor = vec4(pow(col, vec3(0.8)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "l-systems",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.1681,
      "std": 0.1456,
      "unique_colors": 499
     },
     "image": "/specimens/l-systems-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "space-colonization-trees",
  "climbing-plants-simulation",
  "ecosystem-plant-distribution",
  "cga-shape-grammar"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/procgen/l-systems.json"
 },
 "solves": [
  "generate trees and plants procedurally",
  "need branching structures from simple rewrite rules",
  "make fractal growth patterns like ferns",
  "vary vegetation models without modeling each by hand"
 ],
 "authority": "Prusinkiewicz & Lindenmayer",
 "url": "https://texelatlas.vercel.app/t/l-systems/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 248.4,
  "tier": "extreme",
  "p50_ms": 8.1725,
  "p95_ms": 8.1936,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "l-systems-specimen",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 240.54,
   "tier": "extreme",
   "p50_ms": 3.8246,
   "p95_ms": 3.8595,
   "speedup_x": 2.14,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 161.14,
   "tier": "extreme",
   "p50_ms": 4.6408,
   "p95_ms": 4.6418,
   "speedup_x": 1.76,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}