Which turtle can reach the finish line first?
★★★With multiple turtles and a random forward movement, a race can be simulated.
Write a program that runs a race of up to 8 turtles moving up the screen 240 pixels from a starting position. Each turtle can move between 0-10 pixels in each turn. All the turtles will finish the race, but once a turtle has reached the finish line it will stop moving. The results of the race should be output.
Remember to add a comment before a subprogram, condition or iteration to explain its purpose.
Extend the main program so that:
racing_turtles are created. For each turtle it:
silk constant. E.g. turtle 0 is red, turtle 1 is blue etc.t.position.Complete the subprogram called draw_finish_line that:
referee that moves up the screen to the finish_line.Complete the main program so that:
draw_finish_line subprogram is called.starters_orders subprogram is called.race subprogram is called.Complete the subprogram called starters_orders that:
Complete the subprogram called race that:
speed if it has not already finished the race.Typical outputs from the program would be:
Results: 1 : salmon 2 : purple 3 : blue 4 : green 5 : red 6 : orange