subject

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 hel

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
How do i delete my account on this because i didn't read this agreements and also i put age at xd
Answers: 1
question
Computers and Technology, 24.06.2019 07:30
John recently worked on a project about various programming languages. he learned that though procedural language programs are useful, they have disadvantages too. what is a disadvantage of programs written in procedural languages? a. programs do not represent data complexity. b. programs take more time to execute. c. programs are prone to security threats. d. programs do not interface with multiple platforms.
Answers: 3
question
Computers and Technology, 24.06.2019 10:30
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
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, 11.10.2019 01:40
question
Geography, 11.10.2019 01:40
question
Health, 11.10.2019 01:40
Questions on the website: 13722362