CS 151 Computational Thinking: Visual Media Applications
(Labs) Project 7
Due: Tuesday, April 4, 2017, 11:59 pm
Fractals and Trees
The assignment is to bring together the lsystem and turtle_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 turtle_interpreter
Create a file called abstract.py. The file will need to
import sys, turtle, lsystem, and turtle_interpreter. Write a function
that creates an abstract image using L-systems. This image should be
constructed to take advantage of your Python programming skills --
don't rely wholly on the random package and a loop. Your goal should be
complexity, yet order in your image and simplicity in your code. One
idea is to make an interesting pattern.
Your image 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.
Please avoid use any command-line arguments, such as file
names or angles or distances or iterations. Instead, you
should hard code those values in your main program. It is easiest
for us to test your files if we don't have to worry about using the
correct command-line arguments.
In your image 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.
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, 46, and 60. Use a double for-loop to create the grid. Note: Again,
please avoid use any command-line arguments in your program.
A picture with a grid of L-systems is required image
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 (look at
pages 9, 10, and 25 for single-rule L-systems)
or make up one of your own. The scene does not need to be complex,
but your code should exhibit modularity and good design. Note: Again,
please avoid use any command-line arguments in your program.
A scene that includes 2 different L-systems is required
Import one of your scenes from project 2 or 3 and add trees or fractal
shapes to them. It's all turtle graphics, after all.
Make your abstract image function take in (x, y, scale) as parameters
and demonstrate you can properly translate and scale the abstract
image by including multiple copies, at different locations and scales,
in one scene.
Make task 2 more interesting by adding additional elements to the
image that also change across the grid. For example, make the trees
move from summer to fall to winter along the horizontal or vertical
Give the function for task 2 the parameters (x, y, scale) and
demonstrate you can properly translate and scale the grid.
Create an L-system of your own that draws something interesting.
Add leaves, berries, or color to your trees by adding new alphabet
symbols to the rules and cases to your turtle_interpreter. For each new
symbol you use in a rule, you will need another elif case in your
Write-up and Hand-in
Turn in your code by putting it into your private hand-in directory on the
Courses server. All files should be organized in a folder titled "Project
7" and you should include only those files necessary to run the program. We
will grade all files turned in, so please do not turn in old, non-working,
versions of files.
Make a new wiki page for your
assignment. Put the label cs151s17project7 in the label field
on the bottom of the page. But give the page a meaningful title (e.g.
Ying's Project 7).
In general, your intended audience for your write-up is your peers not in
the class. Your goal should be to be able to use it to explain to friends
what you accomplished in this project and to give them a sense of how you
did it. 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. Code snippets
should be small segments of code--usually less than a whole
function--that demonstrate a particular concept. If you find
yourself including more than 5-10 lines of code, it's probably not a
snippet. You should not include all your code in the writeup
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.
A list of people you worked with, including TAs, and professors.
Include in that list anyone whose code you may have seen, such as those
of friends who have taken the course in a previous semester.
Don't forget to label your writeup so that it is easy for others to find.
For this lab, use cs151s17project7
To check whether you've made your images and their text clear, you may
ask yourself the following questions:
Does the text describe the content of the image?
Does the text describe how the content was generated? (this will be
relevant if the image is of a drawing that was created by a program or
of data that was collected or analyzed by your code).
Does the text describe any implications of the content? (e.g. if the
content is results from a simulation, does it analyze the results. This
may not be relevant in CS151.)
If the image contains data, are the data properly labeled? (This may
not be relevant in CS151.)
If the image contains a lot of parts (e.g. the screen dump of a lot
of numbers), are the most important parts highlighted in some way?
(I.e. is the image or graph too cluttered or does it tell a clear