Instructions for treeParts

(produced at 23:59 UTC on 2024-02-05)

Put all of your work for this task into the file treeParts.py
(which is provided among the starter files)

For this problem set, you have a choice: you may complete this task OR the musicalMeasures task, but you do not need to complete both. treeParts (this task) is graphics-oriented and works with turtle graphics, while musicalMeasures is based on audio and music instead, using the wavesynth library.

This task will help you practice the material on custom functions and how to use several functions together to achieve a complicated result.

In this task, your ultimate goal is to draw leaves, twigs, branches, and ultimately trees, like these ones:

Seven trees arranged into a back row of four trees and a front row of
three trees. Each tree is slightly different in terms of the lengths and
angles of the branches and twigs, but they each have one trunk that spits
into four branches, each of which splits into three twigs each of which
has two leaves at the end. There are circular orange fruits drawn hanging
from the end of each branch. A single tree with silver-gray bark. It has the same structure as the
trees in the previous example, with four branches, twelve twigs, and
twenty-four leaves. This one has four pink flowers at the end of each
branch, instead of fruit.

You will accomplish this task by completing several subtasks. You should do these subtasks in order.

You are free to design your tree however you'd like: your functions may use parameters or not, and may or may not have return values. However, there are two restrictions: each function must draw something, and except for main, they must each move the turtle back to wherever it started when the function was called.

Subtask A: leaf

The leaf function has been provided for you, but you are free to modify it, including by changing the number of parameters used, what it draws, or the return value. The provided leaf function illustrates one strategy for returning the turtle to where it started: after drawing what you want to draw, move backwards retracing your steps to get back to where you started.

It does still need to draw something.

Subtask B: twig

The twig function must draw something, and must call leaf at lest twice. As with leaf, it must put the turtle back where it started when it's done..

The first example shows how the twig function could work, but remember that you're free to have it draw whatever you want, and you do not have to stick to the suggested parameters or return value.

Subtask C: branch

Just like the twig function, the branch function must:

  1. Draw something,
  2. call twig at least twice,
  3. put the turtle back where it started when it's done

Also, it must call either left or right to turn the turtle at some point.

This example shows one way the branch function could work.

Subtask D: tree

The tree function must:

  1. Draw something,
  2. call branch at least twice,
  3. put the turtle back where it started when it's done
  4. call either left or right to turn the turtle at some point.

This example shows one way the tree function could work.

Subtask E: main

Because you're free to design your tree function with any number of parameters, there's now way for us to call your tree function directly. To solve this issue, you must define a main function which has zero parameters and which calls your tree function at least once. Unlike the other functions, the main function does not need to call any drawing functions directly. It must complete without crashing, however.

We recommend adding a call to your main function at the end of your file so that it will be called every time you run the file.

This example shows one way the main function could work.

Testing

We have provided a file named test_treeParts.py which can be used to check some of the constraints specified above, but you should rely on Potluck for thorough testing. We recommend that you test each function as you build it, because the lessons you learn from debugging your earlier functions will help you improve the later functions.

If you want to test that you are returning to the starting position for the twig, branch, and tree functions, follow the instructions in test_treeParts.py to fill in the required example functions and uncomment the extra testing call at the end of that file.

We recommend you use noTrace and showPicture to speed up drawing, although turning them off while debugging can also be informative.

Notes

Examples

Twig

This example shows what the twig function might draw, print, and return (note that your twig function does not have to be fruitful). Note that when the function is finished, the turtle is positioned back at the base of the twig, in the same place (and oriented in the same direction) that it started in. This is true for the following examples as well.

In []:
# Draw the twig: top = twig(10, 100, 'Sienna', 'SpringGreen2') # Show the turtle's position (it's back at the start) color('black') stamp()
Prints
A 10-pensize Sienna horizontal line from (0, 0) to (100, 0). Start of filled shape. A 2-pensize SpringGreen2 ellipse centered at (123, 9) with a 25-unit major axis at 20° and a 16.7-unit minor axis Filled in shape using SpringGreen2. Start of filled shape. A 2-pensize SpringGreen2 ellipse centered at (123, -9) with a 25-unit major axis at 160° and a 16.7-unit minor axis Filled in shape using SpringGreen2.
Out[]:
232
Image 
A brown twig (a line) pointing to the right of the origin, with two
thick rounded green lines (leaves) attached to its end. The leaves are
angled +20° and -20° relative to the twig itself, which is perfectly
horizontal.

Branch

This example shows what the branch function might draw, print, and return. As with the twig, your function does not need to return anything. Note how the turtle returns to where it started even though it did not start at the origin.

In []:
# First, rotate a bit and back up lt(25) leap(-60) # Draw the branch: top = branch(12, 80, 50, 'Wheat4', 'DarkOliveGreen2', 'LightGray') # Show the turtle's position (it's back at the start) color('black') stamp()
Prints
A 12-pensize Wheat4 25° line from (-54, -25) to (18, 8). A 12-pensize Wheat4 65° line from (18, 8) to (39, 54). Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (40, 66) with a 12.5-unit major axis at 85° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (48, 63) with a 12.5-unit major axis at 45° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. A 12-pensize Wheat4 25° line from (18, 8) to (63, 30). Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (72, 38) with a 12.5-unit major axis at 45° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (76, 31) with a 12.5-unit major axis at 5° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. A 12-pensize Wheat4 165° line from (18, 8) to (66, -4). Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (79, -3) with a 12.5-unit major axis at 5° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize DarkOliveGreen2 ellipse centered at (77, -12) with a 12.5-unit major axis at 145° and a 8.3-unit minor axis Filled in shape using DarkOliveGreen2. Start of filled shape. A 2-pensize LightGray ellipse centered at (24, 11) with a 6.8-unit major axis at 25° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (23, 4) with a 6.8-unit major axis at 133° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (15, 3) with a 6.8-unit major axis at 61° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (11, 10) with a 6.8-unit major axis at 169° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray ellipse centered at (17, 15) with a 6.8-unit major axis at 97° and a 4.5-unit minor axis Filled in shape using LightGray. Start of filled shape. A 2-pensize LightGray circle centered at (18, 8) with radius 3.4 Filled in shape using LightGray.
Out[]:
261
Image 
A brown branch pointing 25° up and to the right, starting below and to
the left of the origin and passing through it. It has three twigs
attached to its end, each of which is a brown line with two green lines
(leaves) attached (see previous description). The twigs are angled at
-40°, 0°, and +40° relative to the angle of the branch, and their bases
are at the tip of the line that forms the branch. At the base of the
branch is a black arrow showing the turtle's final position: back where
it started.

Tree

This example shows what the tree function might draw, print, and return. Once again, your result value doesn't have to be like this, and you don't need a return value at all if you don't want one. Notice that the turtle's final position (indicated by the black stamp) is the same as its starting position.

In []:
# Setup teleport(0, -120) # Draw the tree tree(18, 210, 140, 60, "Chocolate4", "Chartreuse2", "red") # Show the turtle's position (it's back at the start) color('black') stamp()
Prints
A 18-pensize Chocolate4 horizontal line from (0, -120) to (210, -120). A 9-pensize Chocolate4 120° line from (210, -120) to (280, -241). A 9-pensize Chocolate4 160° line from (280, -241) to (336, -262). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (351, -262) with a 15-unit horizontal major axis and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (348, -271) with a 15-unit major axis at 140° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 120° line from (280, -241) to (310, -293). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (321, -303) with a 15-unit major axis at 140° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (313, -308) with a 15-unit major axis at 100° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 80° line from (280, -241) to (270, -300). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (272, -315) with a 15-unit major axis at 100° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (262, -313) with a 15-unit major axis at 60° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (284, -248) with a 8.1-unit major axis at 120° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (275, -247) with a 8.1-unit major axis at 48° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (273, -238) with a 8.1-unit major axis at 156° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (281, -233) with a 8.1-unit major axis at 84° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (288, -240) with a 8.1-unit major axis at 12° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (280, -241) with radius 4.1 Filled in shape using red. A 9-pensize Chocolate4 160° line from (210, -120) to (342, -168). A 9-pensize Chocolate4 20° line from (342, -168) to (398, -147). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (409, -138) with a 15-unit major axis at 40° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (413, -147) with a 15-unit horizontal major axis and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 160° line from (342, -168) to (398, -188). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (413, -188) with a 15-unit horizontal major axis and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (409, -198) with a 15-unit major axis at 140° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 120° line from (342, -168) to (372, -220). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (383, -229) with a 15-unit major axis at 140° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (374, -235) with a 15-unit major axis at 100° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (349, -171) with a 8.1-unit major axis at 160° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (341, -176) with a 8.1-unit major axis at 88° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (334, -170) with a 8.1-unit major axis at 16° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (337, -161) with a 8.1-unit major axis at 124° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (347, -161) with a 8.1-unit major axis at 52° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (342, -168) with radius 4.1 Filled in shape using red. A 9-pensize Chocolate4 20° line from (210, -120) to (342, -72). A 9-pensize Chocolate4 60° line from (342, -72) to (372, -20). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (374, -5) with a 15-unit major axis at 80° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (383, -11) with a 15-unit major axis at 40° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 20° line from (342, -72) to (398, -52). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (409, -42) with a 15-unit major axis at 40° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (413, -52) with a 15-unit horizontal major axis and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 160° line from (342, -72) to (398, -93). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (413, -93) with a 15-unit horizontal major axis and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (409, -102) with a 15-unit major axis at 140° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (349, -69) with a 8.1-unit major axis at 20° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (347, -79) with a 8.1-unit major axis at 128° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (337, -79) with a 8.1-unit major axis at 56° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (334, -70) with a 8.1-unit major axis at 164° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (341, -64) with a 8.1-unit major axis at 92° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (342, -72) with radius 4.1 Filled in shape using red. A 9-pensize Chocolate4 60° line from (210, -120) to (280, 1). A 9-pensize Chocolate4 100° line from (280, 1) to (270, 60). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (262, 73) with a 15-unit major axis at 120° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (272, 75) with a 15-unit major axis at 80° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 60° line from (280, 1) to (310, 53). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (313, 68) with a 15-unit major axis at 80° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (321, 63) with a 15-unit major axis at 40° and a 10-unit minor axis Filled in shape using Chartreuse2. A 9-pensize Chocolate4 20° line from (280, 1) to (336, 22). Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (348, 31) with a 15-unit major axis at 40° and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize Chartreuse2 ellipse centered at (351, 22) with a 15-unit horizontal major axis and a 10-unit minor axis Filled in shape using Chartreuse2. Start of filled shape. A 2-pensize red ellipse centered at (284, 8) with a 8.1-unit major axis at 60° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (288, 0) with a 8.1-unit major axis at 168° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (281, -7) with a 8.1-unit major axis at 96° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (273, -2) with a 8.1-unit major axis at 24° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red ellipse centered at (275, 7) with a 8.1-unit major axis at 132° and a 5.4-unit minor axis Filled in shape using red. Start of filled shape. A 2-pensize red circle centered at (280, 1) with radius 4.1 Filled in shape using red.
Out[]:
372
Image 
A brown tree consisting of a line pointing 85° upwards with four branches
sprouting from its tip. Each branch has the structure described earlier
including three twigs and two leaves per twig. The branches are at -60°,
-20°, +20°, and +60° relative to the trunk. Note that the widths of the
branches and twigs are half the width of the trunk. A black arrow at the
base of the tree indicates where it ended up, which is also where it
started.

Main

This example shows how the main function doesn't accept any parameters. This is required so that we can test your code without knowing what parameters you chose to put in your tree function. The turtle does NOT have to end up back where it started, and you can (like in this example) call tree more than once if you like.

In []:
# Draw the tree(s) main() # Show the turtle's position (it's NOT back at the start) color('black') stamp()
Prints
A 15-pensize Sienna vertical line from (0, -120) to (0, 60). A 7.5-pensize Sienna 30° line from (0, 60) to (104, 120). A 7.5-pensize Sienna 70° line from (104, 120) to (124, 176). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (124, 191) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (134, 188) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 30° line from (104, 120) to (156, 150). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (166, 161) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (171, 153) with a 15-unit major axis at 10° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 170° line from (104, 120) to (163, 110). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (178, 112) with a 15-unit major axis at 10° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (176, 102) with a 15-unit major axis at 150° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (111, 124) with a 8.1-unit major axis at 30° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (110, 115) with a 8.1-unit major axis at 138° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (101, 113) with a 8.1-unit major axis at 66° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (96, 121) with a 8.1-unit major axis at 174° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (102, 128) with a 8.1-unit major axis at 102° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (104, 120) with radius 4.1 Filled in shape using pink. A 7.5-pensize Sienna 70° line from (0, 60) to (41, 173). A 7.5-pensize Sienna 110° line from (41, 173) to (21, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (11, 241) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (21, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 70° line from (41, 173) to (62, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (62, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (71, 241) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 30° line from (41, 173) to (93, 203). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (103, 214) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (108, 205) with a 15-unit major axis at 10° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (44, 180) with a 8.1-unit major axis at 70° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (49, 172) with a 8.1-unit major axis at 178° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (43, 165) with a 8.1-unit major axis at 106° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (34, 168) with a 8.1-unit major axis at 34° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (35, 178) with a 8.1-unit major axis at 142° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (41, 173) with radius 4.1 Filled in shape using pink. A 7.5-pensize Sienna 110° line from (0, 60) to (-41, 173). A 7.5-pensize Sienna 150° line from (-41, 173) to (-93, 203). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-108, 205) with a 15-unit major axis at 170° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-103, 214) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 110° line from (-41, 173) to (-62, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-71, 241) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-62, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 70° line from (-41, 173) to (-21, 229). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-21, 244) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-11, 241) with a 15-unit major axis at 50° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (-44, 180) with a 8.1-unit major axis at 110° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-35, 178) with a 8.1-unit major axis at 38° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-34, 168) with a 8.1-unit major axis at 146° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-43, 165) with a 8.1-unit major axis at 74° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-49, 172) with a 8.1-unit major axis at 2° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (-41, 173) with radius 4.1 Filled in shape using pink. A 7.5-pensize Sienna 150° line from (0, 60) to (-104, 120). A 7.5-pensize Sienna 10° line from (-104, 120) to (-163, 110). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-176, 102) with a 15-unit major axis at 30° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-178, 112) with a 15-unit major axis at 170° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 150° line from (-104, 120) to (-156, 150). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-171, 153) with a 15-unit major axis at 170° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-166, 161) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. A 7.5-pensize Sienna 110° line from (-104, 120) to (-124, 176). Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-134, 188) with a 15-unit major axis at 130° and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize SpringGreen1 ellipse centered at (-124, 191) with a 15-unit vertical major axis and a 10-unit minor axis Filled in shape using SpringGreen1. Start of filled shape. A 2-pensize pink ellipse centered at (-111, 124) with a 8.1-unit major axis at 150° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-102, 128) with a 8.1-unit major axis at 78° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-96, 121) with a 8.1-unit major axis at 6° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-101, 113) with a 8.1-unit major axis at 114° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink ellipse centered at (-110, 115) with a 8.1-unit major axis at 42° and a 5.4-unit minor axis Filled in shape using pink. Start of filled shape. A 2-pensize pink circle centered at (-104, 120) with radius 4.1 Filled in shape using pink.
Out[]:
483
Image 
TODO

Rubric

Group goals:
 
unknown All functions are documented
Each function you define must include a non-empty documentation string as the very first thing in the function.
 
unknown Do not define functions inside of other functions
None of your function definitions may be placed inside of other function definitions.
 
unknown Do not ignore the results of any fruitful function calls
According to the "Don't waste fruit" principle, every place you call a fruitful function (built-in or custom) you must store the result in a variable, or that function call must be part of a larger expression that uses its return value.
 
unknown Do not create any variables that you never make use of
According to the "Don't waste boxes" principle, every time you create a variable (using = or by defining a parameter for a function) you must also later use that variable as part of another expression. If you need to create a variable that you won't use, it must have the name _, but you should only do this if absolutely necessary.
 
unknown main must not crash.
We will call your main function without any arguments. It should be able to draw something andfinish without crashing.
 
unknown main tree parts must each put the turtle back where they found it.
We will call your main function without any arguments. We will measure where the turtle moves, including where it is at the start and end of each inner function call. We will check to make sure that the position at the start of the tree and each branch, twig, and leaf is the same as the position after that function call is done, including x, y position and heading.
 
unknown Define leaf
Use def to define leaf
 
unknown leaf must call one of the required turtle drawing functions.
Within the definition of leaf, we will inspect the code for leaf and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Define twig
Use def to define twig
 
unknown twig must call one of the required turtle drawing functions.
Within the definition of twig, we will inspect the code for twig and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Call leaf
Within the definition of twig, call leaf in at least 2 places.
 
unknown Define branch
Use def to define branch
 
unknown branch must call one of the required turtle drawing functions.
Within the definition of branch, we will inspect the code for branch and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown branch must call one of the required turtle turning functions.
Within the definition of branch, we will inspect the code for branch and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Call twig
Within the definition of branch, call twig in at least 2 places.
 
unknown Define tree
Use def to define tree
 
unknown tree must call one of the required turtle drawing functions.
Within the definition of tree, we will inspect the code for tree and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown tree must call one of the required turtle turning functions.
Within the definition of tree, we will inspect the code for tree and check to make sure that it includes at least one call to any of the following functions:
  1. circle
  2. drawCircle
  3. drawEllipse
  4. drawDot
  5. drawSquare
  6. drawRectangle
  7. drawPolygon
  8. drawText
  9. fd
  10. forward
 
unknown Call branch
Within the definition of tree, call branch in at least 2 places.
 
unknown Define main
Use def to define main
 
unknown Call tree
Within the definition of main, call tree in at least one place.