L-System Generator

We will use the default L-System fractal, the Koch Curve, as our example. These are the parameters for the Koch Curve.

Axiom: F++F++F (F means move forward one unit. + means to turn counter-clockwise)

Angle Increment: 60

Initial Angle: 0 (0 degrees points to the left)

Rules: F is replaced with F-F++F-F (- means to turn clockwise)

The turtle will start out at the origin facing the left side (0 degrees). To create fractal for iteration 0, we send the turtle the axiom (F++F++F). The turtle will move forward one unit, turn 60 degrees twice, move forward one unit, turn 60 degrees twice, and move forward one unit. This will make an equilateral triangle.

Now for iteration 1, we need to create the command string. By the rule given, every F is iteration 0’s command string is replaced by F-F++F-F. So iteration 1’s command string is F-F++F-F++F-F++F-F++F-F++F-F. So now the turtle is sent this command.

For more iterations, the same process is carried out. So these are the command strings for the specified iterations.

Iteration 0: F-F++F-F (axiom)

Iteration 1: F-F++F-F++F-F++F-F++F-F++F-F

Iteration 2: F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F ++ F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F ++ F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F

Iteration 3: F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F

Notice how quickly the command string increases. This is why on all Lawrencesoft’s samples for the L-System fractal, there are warnings posted about the maximum number of iterations you should run. The Koch Curve should not be run more than 8 times, unless you have a really fast computer.