lsystem | |||||
---|---|---|---|---|---|
SummaryA 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 softwareThe 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/. IntroductionLindenmayer 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 The first alternative, the The second alternative, the Use The
An Known issues
Wish list
References
LicenseThis code is released under the GPL. If you use this software, I'd like to know about it. Release history
AuthorThis module was written by Erik Max Francis. VersionVersion 1.0 $Date: 2002/07/29 $ $Author: max $
|