0

My goal is to create a podium like effect so that the turtles will line up in the order they finished in after they finish the race. The problem is that whenever the red turtle finishes the other turtles stop and no matter where the red turtle finishes it is first and the other turtles won't register as having finished despite having the same code.

Ive tried changing the distance they need to finish the race deleting the if statemetns after if first tinkering with the code

this is what each turtle has to create it except one changed to two etc

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 

code for stopping and placing of the turtles is as follows

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   
physicalattraction
  • 6,485
  • 10
  • 63
  • 122
Brad
  • 21
  • 6
  • instead of `elif first == True:` you should check `elif second == False`. When `first` is `True` then it doesn't mean that `second` is `False` and you can assign two turtles to the same position. Maybe it stops turtles - I can't run code to confirm it. Instead of `one`, `two`, etc. you could use list ie. `turtles[0]`, `turtles[1]`, etc. and then you can use `for` loop to create shorter code. You can assign own values to turtle - ie . instead of `TurtleOne = 500` you can have `one.distance = 500` or `turtles[0].distance = 500`. – furas Apr 05 '19 at 01:43
  • this part of code doesn't explain why turtles stop. Problem can be in different part of code. – furas Apr 05 '19 at 01:44

0 Answers0