My Python Turtle Race!

What Is It? What Does It Do?

The project shown above is my Python project made from Repl.it (A python coding website) and is the making of a turtle race. To make it fun, a new one of the turtles win every time, as it is all random. Now your probably wondering, how do you make this code? Well, let me explain! First, I used a separate turtle to draw the outline of the base by making a big square with the repeat code ( for i in range(): ) around and another line in the square of where the finish is. Then I created the turtles using commands ( ”Name” = turtle.Turtle() ). Then I exported them to positions at the left side of the big square race track (did it by code: ”Name’.goto(x coordinate, y coordinate”). I would then put the pen down/pd (because when lining up to their positions I had it pen up/pu). Anyways, to then make them go a random distance, I would use the code: ”name”.forward(random.randint(min,max)). The basic message was to tell the turtle to go forward a random integer within a random distance between 1-5 and then repeat that 70 times (because at 70 times would be the exact place of where my finish line was located). Then, when one of the turtles crossed the finish line, the others stopped. To show to the one who won, it would go in a victory circle 2 times (Each turtle for this big chunk of commands is listed below). So that’s the explanation of how I made my code and what is was! Here is the code listed below (It’s put into all separate parts to explain every big part):

The code for the importing of the turtle, the importing of the random (the random is there to help make the turtles during the race go a random distance a repetitive amount of times), the turtle creating the track, and the turtle making the finish line.
The first section is the creating the the soon-to-be racing turtles and explaining that there turtles. And the 2nd section is saying which color line for every turtle their having.
This chunk of code tells all the created turtles to bring their pen up and to stop drawing lines for every place and everywhere they go. Then they are all exported and brought to a specific coordinate, which is their starting places for the race. Then as they get to their specific coordinates, they are then told to bring their pen’s back down and to now make a line for everywhere they go again.
(The code above is 2 images) The last big part of the code explains for each of the turtles during the race occurring to move a certain number (integer) forward 1-5, 70 repeated times. Then as one of the random turtles finish first, the others are told to stop, including the one that finished in first place. The first place winner then signals and shows off his victory by pulling of a victory circle twice.
Big pic/ w some of my code to the left, and the results to the right of my total code.

In conclusion, that is what my project and my code is on my Python Turtle Race! If you want to see the code to this project and try it out yourself, here is the hyperlink to the code: RACE HERE! I hope you enjoyed reading this and I hope you have a great day. And as always, I’m Steven and I’ll blog to ya later!