The code is written in Python, using PySFML2
for graphics. The core functionality is in
graphics provided by
The first important function is
build_string, which recursively generates a system string from a starting string
and rule set. It returns a generator to avoid
building the entire string in memory
The second important function is
build_shape, which renders
a string into a set of
(x, y) coordinates tuples based on drawing rules.
The GUI can be invoked with the command
L_app.py system, where system is
an L-system definition. Included are definitions for the shapes shown above, named
While the application is running, the up and down arrows change iteration depth. Escape or command+Q exits the program.
L-System (zip file, 8 KB)