A Python implementation of Aristid Lindenmayer systems (L-Systems) for purely pedagogical purposes.
L-Systems uses Python's turtle graphics for rendering the L-Systems.
Taken from the wikipedia article:
An L-system or Lindenmayer system is a parallel rewriting system and a type of formal grammar.
An L-system consists of an alphabet of symbols that can be used to make strings, a collection of production rules that expand each symbol into some larger string of symbols, an initial "axiom" string from which to begin construction, and a mechanism for translating the generated strings into geometric structures.
L-systems were introduced and developed in 1968 by Aristid Lindenmayer, a Hungarian theoretical biologist and botanist at the University of Utrecht. Lindenmayer used L-systems to describe the behaviour of plant cells and to model the growth processes of plant development. L-systems have also been used to model the morphology of a variety of organisms and can be used to generate self-similar fractals.
- Python 3.12
- Poetry
On macOS I have to additionally install python-tk:
brew install python-tk
To install L-Sytems
run:
poetry install
To execute all the unit-tests run:
poetry run pytest tests
To build and view the project's documentation:
poetry run mkdocs serve
Example implementations of L-Systems can be found under the examples/
directory.
All examples have been taken from the book by Przemyslaw Prusinkiewicz, Aristid Lindenmayer – The Algorithmic Beauty of Plants.
poetry run python examples/bracketed_ol_system_fig1_24f.py
The content of this site is distributed under MIT NON-AI License.