Chat with us, powered by LiveChat CIS1234.3GuidedPractice.docx - STUDENT SOLUTION USA

Guided Practice 4.3 – Advanced Turtle Graphics

Task 1 – Make pseudocode for advanced turtle graphics

We are going to create a program that creates a bunch of random turtle shapes on the screen and then pulls them together into a circle.

Program Catch_The_Turtle:

Set up turtle screen

Set up list of 100 turtles in an array

Place the 100 turtles randomly on the screen

Create a function to move the 100 random turtles

In a for loop

Move the 100 turtles towards the turtle in front of it

Update the turtle screen

Set a timer to call the function recursively after 2 millisecond delay

End.

Change your pseudocode to 200 turtles in the array and change your recursive call to a 1 millisecond delay.

What would happen if you changed the program to 2000 turtles? What impact would it have on the program?

Deliverables for Task 1

· Your Pseudocode

· Answer the questions about 2000 turtles

Task 2 – Putting the program together

First, we need to import the turtle and random modules and then set up the turtle screen.

Text  Description automatically generated

Add a list called chasers with 200 members

Text  Description automatically generated

Then, using a For loop, place them randomly on the turtle screen.

A picture containing graphical user interface  Description automatically generated

Run your program to verify that your shapes are placed and working in your program. Take a screenshot.

Define your turtle automation function by moving the turtle and then moving all chaser objects to follow the turtle.

Text, letter  Description automatically generated

Next, update your turtle screen and then call the function again after 1 millisecond

Text  Description automatically generated

Finally, call your function and then exit the turtle graphics screen.

A picture containing text  Description automatically generated

Run the program and take a screenshot of your completed code and running program.

What problems are there with the program? How could you correct them?

Deliverables for Task 2

· Screenshot of your turtle screen before the animation

· Screenshot of code and running program

· Answer questions about how to fix the program

Task 3 – Adding color

Although the program is works it is very dull since it is all the same color. Let’s change up the program by adding some color to each of the chasers on the page.

The color system we are going to use is called colorsys. IT takes color values and convers them into colors on the screen. These values are called RGB or red, green, blue which is what is used by your computer to make colors.

The command we will use is colorsys.hsv_to_rgb(h, s, v) where h, s and v are values between 0 and 1 which define the color of each object. Finally we’re going to give the turtle to color green so it will be the same color each time.

Text  Description automatically generated

You also might want to change the delay to 0 milliseconds by change screen.ontimer(MoveTurtle,0). Take a screenshot of your completed program code and runtime screen.

Deliverables for Task 3

· Screenshot of your completed colorized code and runtime screen.

image3.png

image4.png

image5.png

image6.png

image7.png

image1.png

image2.png

error: Content is protected !!