ANN: lsystem 1.0 -- Lindenmayer system explorer
Erik Max Francis
max at alcyone.com
Tue Jul 30 01:54:29 EDT 2002
Summary
A simple implementation of Lindenmayer systems (also called
L-systems, substitution systems) is provided. In basic form, a
Lindenmayer system consists of a starting string of symbols from
an alphabet, and has repeated transitions applied to it, specified
by a list of transition search-and-replace rules.
In addition to the standard formulation, two alternative
implementations are included: sequential systems, in which at most
one rule is applied; and tag systems, in which the transition only
takes place at the beginning and end of the string.
Despite being implemented entirely in Python, for reasonable rules
on a modern machine the system is capable of running thousands of
generations per second. Lindenmayer systems are found in
artificial intelligence and artificial life and can be used to
generate fractal patterns (usually via mapping symbols from the
alphabet to turtle commands), organic looking patterns that can
simulate plants or other living things, or even music.
Getting the software
The software is available in a tarball here:
http://www.alcyone.com/pyos/lsystem/lsystem-latest.tar.gz.
The official URL for this Web site is
http://www.alcyone.com/pyos/lsystem/.
Introduction
Lindenmayer systems consist of strings of symbols from an
"alphabet"; in this case, the alphabet is all 8-bit characters.
The starting string is called the axiom (and is simply a string).
Each generation, zero or more transitions are applied to the
string, based on a list of rules. Each rule consists of an
"input" and an "output"; the input is the search substring and the
output is the substring it is to be replaced with. The ordering
of the rules is significant. Null strings are legal as both input
and output; if at the input, they will match at every location,
and if at the output, the search-and-replace will amount to a
delete.
In the basic implementation (the 'LSystem' class), these
transitions are done in order. The system scans through the
string, checking the substring starting with the current position
against each rule's input in order. If that rule's input matches,
that substring is substituted with the output string for that
rule; thus, the ordering of rules is significant. If no rule
matches, that character is left alone and scanning continues.
...
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore
Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
A personal guide to Aliens vs. Predator 2.
More information about the Python-list
mailing list