subject
Computers and Technology, 20.09.2020 14:01 bri9263

You can make improvements to your turtles_in_traffic program to make it more interesting. For example, you can vary the speed of the turtles and/or you can change what happens when they collide. You may choose to implement all of the improvements described in the next two steps or only some of them. Check with your teacher to see if any are required. Make faster and slower turtles: Make the turtles speed up as they move. If they get “too fast,” slow them down again. You can decide how quickly they speed up and when they need to slow down. If you speed up the turtles, they cover more ground faster. Change your code so they do not go off screen. Complete collision management: Change the shape and color when the turtles collide: Delete one of your shapes in your list and use it as the collision shape. Use a new color to indicate a collision. The color does not have to be from your list of colors; you can choose any color as a collision color. Try to recover from a collision. Make the turtles back up a bit and then continue on. You can still change the shape and color of collided turtles as an indicator that they crashed but also indicate they are able to recover. To recover from the collision, your code needs to remember and then restore the original shape and fill color of the turtle. When the turtles stop moving and your program ends, you should indicate that this is intentional and that something did not “break” in the program. Write another nested for loop to change all of the turtles to some color that indicates they are deactivated. # a118_turtles_in_traffic. py # Move turtles horizontally and vertically across screen. # Stopping turtles when they collide. import turtle as trtl trtl. setup(600,600) # create two empty lists of turtles, adding to them later horiz_turtles = [] vert_turtles = [] # use interesting shapes and colors turtle_shapes = ["arrow", "turtle", "circle", "square", "triangle", "classic"] horiz_colors = ["red", "blue", "green", "orange", "purple", "gold"] vert_colors = ["darkred", "darkblue", "lime", "salmon", "indigo", "brown"] tloc = -100 for s in turtle_shapes: ht = trtl. Turtle(shape=s) horiz_turtles. append(ht) ht. penup() new_color = horiz_colors. pop() ht. fillcolor(new_color) ht. goto(-200, tloc) ht. setheading(0) vt = trtl. Turtle(shape=s) vert_turtles. append(vt) vt. penup() new_color = vert_colors. pop() vt. fillcolor(new_color) vt. goto( -tloc, 200) vt. setheading(270) tloc += 50 # TODO: move turtles across and down screen, stopping for collisions """ steps = 0 while steps < 50: steps = steps + 1 """ wn = trtl. Screen() wn. mainloop() i need the code answer to this

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
The most common battery cable terminal is a that provides a large surface contact area with the ability to tighten the terminal onto the battery post using a nut and bolt.
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Which type of excel chart should be used to track students’ progress on test grades? line column bar pie
Answers: 2
question
Computers and Technology, 24.06.2019 15:30
Emma is using an artificial intelligence system, which contains information on botany, to identify a type of plant from an image. what type of ai is emma using?
Answers: 1
You know the right answer?
You can make improvements to your turtles_in_traffic program to make it more interesting. For exampl...
Questions
question
Mathematics, 29.05.2021 03:10
question
English, 29.05.2021 03:10
Questions on the website: 13722362