In a previous post I spoke about JavaLogo. When talking about “turtle graphics”, L-systems automatically come to mind. For those who don’t know, L-systems or Lindenmayer systems are a mathematical formalism proposed by the biologist Aristid Lindenmayer in 1968 as a foundation for an axiomatic theory of biological development. More recently, L-systems have found several applications in computer graphics.

Central to L-systems, is the notion of rewriting, where the basic idea is to define complex objects by successively replacing parts of a simple object using a set of rewriting rules or productions. The rewriting can be carried out recursively.

Take the following example:

Axiom: F++F++F
Rewrite rule: F -> F-F++F-F

Now we come to the point where its relation with “turtle graphics” becomes apparent. The F, means draw a line forward. +, means turn left, – means turn right. When we apply the rewrite rule 4 times and when turning left or right always turn 120°, drawing the L-system’s turtle graphics gives us the following figure which is called the Koch Snowflake.

Another example of a L-system is

Axiom: F+F+F+F
Rewrite rule: F -> FF-F-F-F-F-F+F

Applying the rewrite rule 4 times and always turning 90°, gives us this figure:

When you’re looking at creating interesting figures with “turtle graphics”, checking out Lindenmayer systems further might prove worthwhile. Take a look at some examples I made using JavaLogo.

For more info:

#### Aswin van Woudenberg

I'm a software engineer based in the Netherlands. Besides software, I am also interested in areas ranging from music and art to mathematics and literature.