artificial life

Chapter 4: Lindenmayer Systems

4.3 Graphical L-Systems Applet

A Java Applet that takes a grammar from a user, expands the grammar and generates an image, is implemented for this project. The image is generated using only the 6 tokens mentioned earlier {F,f,+,-,[,]}, all other tokens are ignored by the image generator.



Draw button: Draws an image in the main pane depending on the input of the other fields.

n: The number of iterations the L-System goes through before generating the image.

angle: The angle the cursor rotates when it encounters either a ‘+’ or ‘-‘

init: The initial string for the L-System.

grammar: The grammar that the L-System uses to replace characters in initial and subsequent strings. The format for the rules are char=string.



Source Code for Graphical L-Systems Applet:

LSystem.java