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, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
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
Chemistry, 31.10.2019 00:31
question
Mathematics, 31.10.2019 00:31
Questions on the website: 13722362