-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCar_Race.py
70 lines (62 loc) · 1.04 KB
/
Car_Race.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from turtle import *
from random import randint
setup_run = False
w = 0
def auto(color, y_offset, rando, first_run_finish):
penup()
if (first_run_finish == False):
setx(600)
else:
forward(rando)
print(rando)
fillcolor(color)
sety(y_offset)
pendown()
left(90)
forward(50)
left(90)
forward(50)
right(45)
forward(50)
left(45)
forward(50)
left(45)
forward(50)
right(45)
forward(50)
left(90)
forward(50)
left(90)
forward(220.71)
penup()
x = (xcor() - 30)
y = (ycor() - 20)
setx(x)
sety(y)
# setpos(-30, -20)
pendown()
begin_fill()
circle(20)
end_fill()
penup()
x = (xcor() - 160)
y = (ycor())
setx(x)
sety(y)
# setpos(-190,-20)
pendown()
begin_fill()
circle(20)
end_fill()
penup()
resizemode("auto")
setup(width=.99, height=.99, startx=0, starty=0)
while (w <= 10):
print("GO")
auto(color="green", y_offset=0, rando=(randint(0, 100)),first_run_finish=setup_run)
auto(color="red", y_offset=100, rando=(randint(0, 100)),first_run_finish=setup_run)
clear()
setup_run = True
w = w + 1
print("END")
input()