Skip to end of metadata
Go to start of metadata

Alex Sisto

CS 151 Project 7

Due Date: April 7th 2015


The purpose of this project was to become familiar with L-system grammars and use them to make visual images. We created two files, lsystem.py and turtle_interpreter to read a text file with the lsystem base and rule. Once that information has been read the turtle_interpreter interprets specific letters as different commands from the turtle module. I used these files to create multiple different fractal patterns and images containing fractals.

Task 1:

In task 1 the goal was to create an abstract image using only fractals. I found one lsystem rule in 'The Algorithmic Beauty of Plants' to make the large pyramid shaped fractals. This fractal also conveniently had space within to contain other fractals, so I inserted two copies each of two more fractals. I varied pen width and color to make the image more aesthetically pleasing.

Task 2:

In task 2 we had to make a 3x3 grid containing 9 copies of the systemB lsystem rule from lab. The number of iterations increase from 1 to 3 as one moves right across the columns. The angle between the branches increases from 22 to 60 going down rows.

Task 3:

For task 3 we were supposed to create a nonabstract scene containing a tree lsystem and at least two fractals. I fulfilled one extension by importing fractals into my project 2 file. I replaced the sun with the Koch's snowflake fractal. I found the rule and base code at http://mathworld.wolfram.com/KochSnowflake.html. For the trees I added leaves and berries to them fulfilling another extension. I built on the systemB lsystem and merely added two new letters at the end of each bracket. This means a berry and leaf are drawn at the end of each branch. I also had to edit the turtle_interpreter file to create new rules for the new letters I added into the lystem text file. The trees also have a random offset, like the original trees I had in my project 2.


For my abstract image I added ( x, y, scale) functionality, as can be seen in the image below.

For another extension I chose to vary the color of each fractal by the column that it is located in. Column 1 is summer and green. Column 2 is fall and orange. Column 3 is brown and winter. I also enabled x, y, and scale inputs allowing me to place different sized file grids and different locations.

What I Learned

I learned how to use lsystems to create very complex patterns and images simply. Without the use of lsystems the images I made for the project would be incredibly difficult, if not impossible, to reproduce using just the knowledge I had when I did project 3. I am also becoming more and more comfortable with encapsulation.


The Algorithmic Beauty of Plants for the pyramid lsystem

http://mathworld.wolfram.com/KochSnowflake.html For the base and rule for Koch's snowflake.