Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stage 6: Drawing the Forest 40% Complete this part in Al.py and submit through the assignment drop box. Complete the two functions to handle drawing

image text in transcribed

Stage 6: Drawing the Forest 40% Complete this part in Al.py and submit through the assignment drop box. Complete the two functions to handle drawing the forest. draw_trees) This function takes as a parameter an instance of the Forest class, and must move the turtle to the appropriate place to draw each tree and commence drawing using the draw function defined below. The bases of the trees should be spaced out evenly within the window, such that gaps between the outer trees and the sides of the window, and the gaps between the trees are all the same size. draw ) This function takes as a parameter an instance of the Tree class and an integer representing its age and draws the actual tree. The way a tree is drawn is dependent on its age, as well as the properties of that species of tree. A tree is made up of multiple stages. The first stage is always a vertical trunk. Each subsequent stage branches off the previous segment - one branch to the left, and one branch to the right. The angle these segments diverge from the previous segment is determined by the branch angle property of the Tree class. A tree has a number of stages equal to its age. The final stage is drawn in the colour specified by the leaf colour property of the tree, while all other stages are drawn in the colour specified by the branch colour property. This image shows the same species of tree drawn at ages 1, 2, 3, and 4: The length of each segment is determined by the branch length property of the tree species. The final segment (the leaves) are drawn with a length equal to the tree's branch length property. Each segment preceding it is drawn based on a multiple of that length In the above example, the tree has a branch length of 10. In the case of the age 1 tree, this means that it has a single segment of length 10. In the case of the age 2 tree, the trunk (the first segment) has a length of 20, and the leaves (the following segment) are drawn with length 10. In the case of the age 4 tree, the main trunk has a length of 40, the next set of branches have a length of 30 the next 20, and the leaves at the end have a length of 10. In the above example, the tree has the following values: Branch Length: 10 Branch Colour: 150, 75, 0 Leaf Colour: 0, 255, 0 Branch Angle: 30 Important Note: In order for any marks to be awarded for this section, the draw function must be a recursive function! Stage 6: Drawing the Forest 40% Complete this part in Al.py and submit through the assignment drop box. Complete the two functions to handle drawing the forest. draw_trees) This function takes as a parameter an instance of the Forest class, and must move the turtle to the appropriate place to draw each tree and commence drawing using the draw function defined below. The bases of the trees should be spaced out evenly within the window, such that gaps between the outer trees and the sides of the window, and the gaps between the trees are all the same size. draw ) This function takes as a parameter an instance of the Tree class and an integer representing its age and draws the actual tree. The way a tree is drawn is dependent on its age, as well as the properties of that species of tree. A tree is made up of multiple stages. The first stage is always a vertical trunk. Each subsequent stage branches off the previous segment - one branch to the left, and one branch to the right. The angle these segments diverge from the previous segment is determined by the branch angle property of the Tree class. A tree has a number of stages equal to its age. The final stage is drawn in the colour specified by the leaf colour property of the tree, while all other stages are drawn in the colour specified by the branch colour property. This image shows the same species of tree drawn at ages 1, 2, 3, and 4: The length of each segment is determined by the branch length property of the tree species. The final segment (the leaves) are drawn with a length equal to the tree's branch length property. Each segment preceding it is drawn based on a multiple of that length In the above example, the tree has a branch length of 10. In the case of the age 1 tree, this means that it has a single segment of length 10. In the case of the age 2 tree, the trunk (the first segment) has a length of 20, and the leaves (the following segment) are drawn with length 10. In the case of the age 4 tree, the main trunk has a length of 40, the next set of branches have a length of 30 the next 20, and the leaves at the end have a length of 10. In the above example, the tree has the following values: Branch Length: 10 Branch Colour: 150, 75, 0 Leaf Colour: 0, 255, 0 Branch Angle: 30 Important Note: In order for any marks to be awarded for this section, the draw function must be a recursive function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions