CS 151: Project #7

Project 7: Fractals and Trees

Main course page

The assignment is to bring together the lsystem and interpreter pieces to make a scene that consists of fractal shapes, trees, and other turtle graphics (think back to projects 1, 2 and 3). Your top-level program will include both the lsystem and interpreter modules.


  1. Create a file called abstract.py. The file will need to import sys, turtle, lsystem, and interpreter. Write a function that creates an abstract image using L-systems. Make one aspect of your image take advantage of the capability of a computer to generate complexity with simple code (don't rely wholly on the random package and a loop).

    Your scene should include at least three different L-systems, with at least one of them using brackets. Don't feel beholden to use the suggested number of iterations or angles for any L-system. You can get the filenames for the L-system files from the command line, by asking the user for them, or by hard-coding them into your code.

    In your scene function, you can use turtle commands to pick up the pen, move it to a new location, change colors, change pen widths, and put down the pen before drawing a new shape.

    A picture with 3 different L-systems is required image 1.

  2. Make a new file grid.py that contains a function that draws a set of 9 trees based on the systemB L-system, or some variation of it that has brackets. Order the 9 trees as a 3x3 grid. From left to right the number of iterations of the L-system should go from 1 to 3. From top to bottom, the angle of the L-system should be 22.5, 45, and 60. Use a double for-loop to create the grid.

    A picture with a grid of L-systems is required image 2.

  3. Make a new file scene.py that makes a non-abstract scene with two or more objects generated using L-systems. The scene must include at least one new L-system with brackets (e.g. a tree) that you haven't used yet. You can use one of the L-systems from ABOP or make up one of your own. The scene does not need to be complex, but your code should exhibit modularity and good design.

    A scene that includes 2 different L-systems is required image 3.



Make a new wiki page for your assignment. Give the page a useful title using English words. Put the label cs151f12proj7 on the page.

In addition to making the wiki page writeup, put the python files you wrote on the Courses server in your handin directory.

Colby Wiki

In general, your writeup should follow the outline below.