Project 7: Fractals and Trees
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 transformer modules.
Create a file called scene.py. The file will need to import sys,
turtle, lsystem, and interpreter. You may also want to import the
random package. Write a function scene1()that creates a
simple scene using L-systems. Your scene should include at least one
fractal shape and one tree. You can get the L-system file from the
command line, by asking the user for it, or by hard-coding it into the
You can use turtle commands to pick up the pen, move it to a new location, and put down the pen before drawing a new shape.
This is required image 1.
Write a function scene2() that draws a set of 9 trees based
on the systemB L-system, or some variation of it. 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.
This is required image 2.
Write a function scene3() that makes a simple outdoor scene with
trees generated using L-systems. Scene 3 should include at least one
new L-system. You can use one of the L-systems from ABOP or make up
one of your own. Scene 3 should also have trees of different sizes.
This is required image 3.
- Import your scenes from project 2 or 3 and add trees or fractal shapes to them. It's all turtle graphics, after all.
- Create an L-system of your own that draws something interesting.
- Add leaves, berries, or color to your trees by adding symbols to the rules and cases to your interpreter. For each new symbol, you will need another elif case in your drawString function.
Make a new wiki page for your assignment. Give the page a useful title using English words (cs151s10proj7 is not a useful title). Put the label cs151s10proj7 on the page. Each of you needs to make your own writeup.
In addition to making the wiki page writeup, put the python files you wrote on the Academics server in your handin directory.
In general, your writeup should follow the outline below.
- A brief summary of the task, in your own words. This should be no more than a few sentences. Give the reader context and identify the key purpose of the assignment.
- A description of your solution to the tasks, including any images you created. This should be a description of the form and functionality of your final code. You may want to incorporate code snippets in your description to point out relevant features. Note any unique computational solutions you developed.
- A description of any extensions you undertook, including images demonstrating those extensions. If you added any modules, functions, or other design components, note their structure and the algorithms you used.
- A brief description (1-3 sentences) of what you learned.
- Don't forget to label your writeup so that it appears in the listing on the main wiki page for the course. For this lab, use cs151s10proj7