forked from 16umm001/Turtle-Race-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.py
45 lines (44 loc) · 768 Bytes
/
game.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
from turtle import *
from random import randint
speed(10)
penup()
goto (-140,140)
for step in range(14):
write(step, align='center')
right(90)
forward(10)
pendown()
forward(150)
penup()
backward(160)
left(90)
forward(20)
ada = Turtle()
ada.color('red')
ada.shape('turtle')
ada.penup()
ada.goto(-160,100)
ada.pendown()
bob = Turtle()
bob.color('blue')
bob.shape('turtle')
bob.penup()
bob.goto(-160,70)
bob.pendown()
cat = Turtle()
cat.color('green')
cat.shape('turtle')
cat.penup()
cat.goto(-160,40)
cat.pendown()
dog = Turtle()
dog.color('black')
dog.shape('turtle')
dog.penup()
dog.goto(-160,10)
dog.pendown()
for turn in range(100):
ada.forward(randint(1,5))
bob.forward(randint(1,5))
cat.forward(randint(1,5))
dog.forward(randint(1,5))