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.

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 lecturer at the NHL Stenden University of Applied Sciences where I teach Artificial Intelligence, Algorithms and Concurrent Programming. Together with my students I'm building dialogue systems that can learn, reason and converse in a variety of domains.

Leave a Reply

Your email address will not be published. Required fields are marked *