Hi, can you help me add these requirements in my Turtle python program. The prog
ID: 3875055 • Letter: H
Question
Hi, can you help me add these requirements in my Turtle python program. The program is supposed to run an Olympics skating game. The program is below the requirements. Thanks
Requirements
-Your race will be random generated so each time there is a possibility that a different winner.
-Have a countdown of “READY” “SET” “GO” appear on the screen and then the turtles take off.
-Have the program tell the winner[s].
-Award Medals.
-User may guess who will win.
-Allow the user to continue to do the game over and over again until they do not want to do it anymore.
-When the user choose to exit - Display a new screen and recap the events.
-Make sure you have a information screen for user explaining the Game.
-Make your program screens look nice.
-Menu.
Program:
#!/bin/python3
from turtle import *
from random import randint
speed(0)
penup()
goto(-140, 140)
for step in range(15):
write(step, align='center')
right(90)
for num in range(8):
penup()
forward(10)
pendown()
forward(10)
penup()
backward(160)
left(90)
forward(20)
ada = Turtle()
ada.color('red')
ada.shape('turtle')
ada.penup()
ada.goto(-160, 100)
ada.pendown()
for turn in range(10):
ada.right(36)
bob = Turtle()
bob.color('blue')
bob.shape('turtle')
bob.penup()
bob.goto(-160, 70)
bob.pendown()
for turn in range(72):
bob.left(5)
ivy = Turtle()
ivy.shape('turtle')
ivy.color('green')
ivy.penup()
ivy.goto(-160, 40)
ivy.pendown()
for turn in range(60):
ivy.right(6)
jim = Turtle()
jim.shape('turtle')
jim.color('orange')
jim.penup()
jim.goto(-160, 10)
jim.pendown()
for turn in range(30):
jim.left(12)
for turn in range(100):
ada.forward(randint(1, 5))
bob.forward(randint(1, 5))
ivy.forward(randint(1, 5))
jim.forward(randint(1, 5))
Explanation / Answer
The logic for above specified requirements wil be folowed as follows:
1> set a Random Countdown for "READY" "SET" "GO"
use the follwing code for it:
above function will set the countdown for 50s and it will be set because of time package has been imported.
2> For awrad medals
set red to max value then green little average and then blue to lower
compare the last /end value with predefined value and print the winner!!
3>Use loop do while to run the program till user wants it.
4> For new screen using the libraries for new screen and for event use the onclick() that will returns the event that had occured.
5>For making screen interactive use window functions and set background color using bgcolor().
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.