Turtle_Race_Finished_-_Google_Chrome_2021-07-13_23-44-16_Trim_AdobeCreativeCloudExpress.1.mp4
ALgorithm:
- Start.
- Import the turtle module.
- Import Random module.
__________________________________ START THE TURTLE ___________________________________
- Create a new turtle t using turtle() function.
- Set turtle speed to ten using speed() function.
- Move the turtle from current position to (-140,140). (position can be set accordingly)
- Create a variable z and assign value 0 to it .
__________________________________ RACING TRACK ________________________________________
- Iterate the for loop 15 times.
- Write text at the centre position using the write() function.
- Rotate the turtle right by 90 degrees using the right() function.
- Move the turtle forward 10 steps using forward function().
- Pull back the pendown on screen using the pendown() function.
- Move the turtle forward 150 steps.
- Move the turtle backward 160 steps.
- Rotate the turtle left by 90 degrees using left() function.
- Move the turtle forward 25 steps.
________________________ Turtle 1 ________________________
- Create a turtle t1.
- Pen up.
- Move the turtle from its current position to (-160,104).
- Change the turtle color to HOT PINK using the color() function.
- Set the shape to turtle using shape() function.
________________________ Turtle 2 ________________________
- Create a turtle t2.
- Repeat the steps 20-23 with its position to(-160,66) and TURQUOISE color
________________________ Turtle 3 ________________________
- Create a turtle t3.
- Repeat the steps 20-23 with its position to(-160,28) and GOLD color.
________________________ Turtle 4 ________________________
- Create a turtle t4.
- Repeat the steps 20-23 with its position to (-160,0) and DARK ORCHID color.
__________________________________ WINNER __________________________________
- Any of the turtles reaches the coordinates of finish line (220) first, will be declared the winner.
- If t1 position is greater than 220 29.1) Print “Pink Turtle won the Race”
- If t2 position is greater than 220 30.1) Print “Blue Turtle won the Race”
- If t3 position is greater than 220 31.1) Print “Yellow Turtle won the Race”
- If t3 position is greater than 220 32.1) Print “Orchid Turtle won the Race”