mcl34n

Untitled

Jan 16th, 2021
575
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from turtle import Turtle
  2. from random import randint
  3. from time import sleep
  4. colors = ["red", "orange", "yellow", "green","blue", "indigo", "violet"]
  5. start_positions = [[-160, X] for X in range(100, -20, -20)]
  6. finish = 100
  7.  
  8.  
  9. turtles = [
  10.     {"name":"Mike","position": start_positions[0]},
  11.     {"naem":"Allison","position":start_positions[1]},
  12.     {"name":"Abigail","position":start_positions[2]},
  13.     {"name":"Aiden","position":start_positions[3]},
  14.     {"name":"Matthew","position":start_positions[4]},
  15.     {"name":"Michael","position":start_positions[5]},
  16.     ]
  17.  
  18. for turtle in turtles:
  19.     turtle["name"] = Turtle()
  20.     turtle["name"].color(colors[turtles.index(turtle)])
  21.     turtle["name"].shape("turtle")
  22.     turtle["name"].penup()
  23.     turtle["name"].goto(turtle["position"])
  24.     turtle["name"].pendown()
  25.  
  26.  
  27. def race():
  28.     while True:
  29.         for turtle in turtles:
  30.             move = randint(1,5)
  31.             turtle["name"].pendown()
  32.             turtle["name"].forward(move)
  33.             turtle["position"][0] += move
  34.             if turtle["position"][0] >= finish:
  35.                 for i in range(0, 500, 46):
  36.                     turtle["name"].forward(i)
  37.                 while True:
  38.                     for turtle in turtles:
  39.                         turtle["name"].color(colors[randint(0,6)])
  40.  
  41.  
  42. if __name__ == "__main__":
  43.     race()
  44.     input()
RAW Paste Data