Introduction
lsystem is a command line tool for interpreting grammars based on the turtle interpretation used in the Algorithmic Beauty of Plants.
Once you have rust and cargo installed, you can install LSYSTEM like so:
# 1. Have rust and cargo installed. See https://www.rust-lang.org/tools/install
# 2. Install the lsystem command line.
cargo install --features=lsystem
You can execute it as so:
lsystem derive <file.name> --output out.svg
The input file should be in the Rusty-Systems plant format, which has some documentation available online. Here is an example
# This describes plant 5 in fig 1.24 of ABOP (pg 25)
n = 6 # Number of derivation iterations. This is one more iteration than in ABOP
delta = 22.5 # The angle that the + and - tokens turn the "turtle" by.
initial: X # The starting string
# The productions
Forward -> Forward Forward
X -> Forward + [ [ X ] - X ] - Forward [ - Forward X ] + X
Example of the plant file format understood by lsystem
Example output
All of the following images are svg files created by LSYSTEM using the example plant files linked below. All of these examples are taken from the Algorithmic Beauty of Plants, as noted below.