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):
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!