DoodleTron (a L-system Iterator)

 

How to play

You start with a simple image surrounded by images which vary a tiny bit. Click on one of the variations, and it moves to the center, surrounded by variations on it. Repeat this 10 to 20 times, and cool things start to appear.

The series of drawings you picked is shown below the selection grid. At the bottom are buttons allowing you to save an interesting image, and a button for starting over.

Click on a starting image to play the game


View the gallery of interesting images.

Enter starting values directly
For Axiom, F, G, X, and Y the input characters are (F,+,-,_,G,X,Y,L,J,.,:).
Enter the characters upper case and leave no spaces between letters or symbols.

Axiom:
F ->
G ->
X ->
Y ->
Angle (degrees):
Depth (1-4):
Starting color (blank for B&W)








Values for Axiom and either F or X must be entered along with an angle and depth.


 

L-systems An L-system is a iterated rewriting system. One simple example is the Koch snowflake which is generated by starting with a triangle. A simple rule is used to modify the image in sucessive rounds. For each iteration every straight line is replaced with a line that has a triangular bump in the middle.


Source: Wikipedia
The first four iterations of the Koch snowflake
 

Very simple L-systems can generate surprisingly good imitations of plants. There are many interesting mathematical properties of L-systems.

My implementation lets a person start with a simple L-system and select among randomly generated variations of the L-system. Each variant image has two changes from the center tile image.

Over the course of a few dozen rounds of selection, surprising images can appear. To see how surprising, look at the gallery, or better yet, try it a few times yourself.

The characters used to describe the L-system are:
+ calls for a counter-clockwise rotation.
- calls for a clockwise rotation.
_ reverses direction.
F and G draw straight line segments.
L instructs the drawing to branch off saving its current position for later movement.
J restores the drawing to position it had prior to the branch.
X and Y call other drawing characters.
. and : Move the color up or down one turn of the color wheel.

Links:
The Wikipedia L-system page provides a friendly introduction to these iterated rewriting systems.

The seed for the Postscript I wrote came from the L-systems page written by Michel Charpentier at the University of New Hampshire.

The Algorithmic Botany site run by Przemyslaw Prusinkiewicz at the University of Calgary has tons of information and includes a downloadable book. The site also has a Java L-systems explorer web app.


 

Here's the code. You can examine the individual files, or grab the whole package in the .tgz file.


Home page Return to the home page


Please send comments or questions regarding this web page to Jim Lund (jlund256 at gmail dot com)