Как добавить 1-ю 2-ю 3-ю функцию в гоночном черепахе? - PullRequest
0 голосов
/ 03 апреля 2019

Моя цель - создать эффект, похожий на подиум, чтобы черепахи выстроились в том порядке, в котором они закончили после окончания гонки. Проблема состоит в том, что всякий раз, когда красная черепаха заканчивает свою работу, другие черепахи останавливаются, и независимо от того, где красная черепаха заканчивает свою работу, она является первой, и другие черепахи не регистрируются как закончившиеся, несмотря на наличие того же кода.

Я пытался изменяя дистанцию, необходимую им, чтобы закончить гонку удаляя if Statemetns после, если первый мастеринг с кодом

это то, что каждая черепаха должна создать, кроме одной, замененной на две и т. Д.

one=Turtle() #name of the turtle
one.color('red') #color of the turtle 
one.shape('turtle') #shape of the turtle 
one.penup() #makes the trail line
one.goto(-220,170) #starting space #first number is horizontal position second is vertical
one.pendown()
for turn in range(36): # how many times it rotates
    one.right(10) # how far the turtle spins each rotation 

код остановки и размещения черепах выглядит следующим образом

first = False
second = False
third = False
fourth = False
fifth = False
sixth = False
seventh = False
eighth = False 

if TurtleOne>=500: #if TurtleOne has traveled more than 500 do the following 
        one.penup()
        if first == False:
            one.goto(-300,-110)
            first = True
        elif first == True:
            one.goto(-250,-110)
            second = True
        elif second == True:
            one.goto(-200,-110)
            third = True
        elif third == True:
            one.goto(-150,-110)
            forth = True
        elif forth == True:
            one.goto(-100,-110)
            fifth = True
        elif fifth == True:
            one.goto(-50,110)
            sixth = True
        elif sixth == True:
            one.goto(0,-110)
            seventh = True 
        elif seventh == True:
            one.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection         
elif TurtleTwo>=500:
        two.penup()
        if first == False:
            two.goto(-300,-110)
            first = True
        elif first == True:
            two.goto(-250,-110)
            second = True
        elif second == True:
            two.goto(-200,-110)
            third = True
        elif third == True:
            two.goto(-150,-110)
            forth = True
        elif forth == True:
            two.goto(-100,-110)
            fifth = True
        elif fifth == True:
            two.goto(-50,110)
            sixth = True
        elif sixth == True:
            two.goto(0,-110)
            seventh = True 
        elif seventh == True:
            two.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
elif TurtleThree>=500:
        three.penup()
        if first == False:
            three.goto(-300,-110)
            first = True
        elif first == True:
            three.goto(-250,-110)
            second = True
        elif second == True:
            three.goto(-200,-110)
            third = True
        elif third == True:
            three.goto(-150,-110)
            forth = True
        elif forth == True:
            three.goto(-100,-110)
            fifth = True
        elif fifth == True:
            three.goto(-50,110)
            sixth = True
        elif sixth == True:
            three.goto(0,-110)
            seventh = True 
        elif seventh == True:
            three.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
elif TurtleFour>=500:
        four.penup()
        if first == False:
            four.goto(-300,-110)
            first = True
        elif first == True:
            four.goto(-250,-110)
            second = True
        elif second == True:
            four.goto(-200,-110)
            third = True
        elif third == True:
            four.goto(-150,-110)
            forth = True
        elif forth == True:
            four.goto(-100,-110)
            fifth = True
        elif fifth == True:
            four.goto(-50,110)
            sixth = True
        elif sixth == True:
            four.goto(0,-110)
            seventh = True 
        elif seventh == True:
            four.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
elif TurtleFive>=500:
        five.penup()
        if first == False:
            five.goto(-300,-110)
            first = True
        elif first == True:
            five.goto(-250,-110)
            second = True
        elif second == True:
            five.goto(-200,-110)
            third = True
        elif third == True:
            five.goto(-150,-110)
            forth = True
        elif forth == True:
            five.goto(-100,-110)
            fifth = True
        elif fifth == True:
            five.goto(-50,110)
            sixth = True
        elif sixth == True:
            five.goto(0,-110)
            seventh = True 
        elif seventh ==True:
            five.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
elif TurtleSix>=500:
        six.penup()
        if first == False:
            six.goto(-300,-110)
            first = True
        elif first == True:
            six.goto(-250,-110)
            second = True
        elif second == True:
            six.goto(-200,-110)
            third = True
        elif third == True:
            six.goto(-150,-110)
            forth = True
        elif forth == True:
            six.goto(-100,-110)
            fifth = True
        elif fifth == True:
            six.goto(-50,110)
            sixth = True
        elif sixth == True:
            six.goto(0,-110)
            seventh = True 
        elif seventh == True:
            six.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
elif TurtleSeven>=500:
        seven.penup()
        if first == False:
            seven.goto(-300,-110)
            first = True
        elif first == True:
            seven.goto(-250,-110)
            second = True
        elif second == True:
            seven.goto(-200,-110)
            third = True
        elif third == True:
            seven.goto(-150,-110)
            forth = True
        elif forth == True:
            seven.goto(-100,-110)
            fifth = True
        elif fifth ==True:
            seven.goto(-50,110)
            sixth = True
        elif sixth == True:
            seven.goto(0,-110)
            seventh = True 
        elif seventh == True:
            seven.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
elif TurtleEight>=500:
        eight.penup()
        if first == False:
            eight.goto(-300,-110)
            first = True
        elif first == True:
            eight.goto(-250,-110)
            second = True
        elif second == True:
            eight.goto(-200,-110)
            third = True
        elif third == True:
            eight.goto(-150,-110)
            forth = True
        elif forth == True:
            eight.goto(-100,-110)
            fifth = True
        elif fifth == True:
            eight.goto(-50,110)
            sixth = True
        elif sixth == True:
            eight.goto(0,-110)
            seventh = True 
        elif seventh == True:
            eight.goto(50,-110)
            eighth = True
        elif eighth == True:
            time.sleep(5) #waits 10 seconds
            turtle.bye()   # closes the window 
            import Lanes   # goes back to lane selection   
...