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 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
An ou structure in your domain has one ou per department, and all the computer and user accounts are in their respective ous. you have configured several gpos defining computer and user policies and linked the gpos to the domain. a group of managers in the marketing department need different policies that differ from those of the rest of the marketing department users and computers, but you don't want to change the top-level ou structure. which of the following gpo processing features are you most likely to use? a, block inheritance b, gpo enforcement c, wmi filtering d, loopback processing
Answers: 3
question
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
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
Social Studies, 11.03.2021 01:00
question
Mathematics, 11.03.2021 01:00
question
Mathematics, 11.03.2021 01:00
question
Mathematics, 11.03.2021 01:00
question
Physics, 11.03.2021 01:00
question
Chemistry, 11.03.2021 01:00
Questions on the website: 13722362