-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaula03.py
64 lines (48 loc) · 977 Bytes
/
aula03.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
import turtle
import random
import time
tela = turtle.Screen()
pl = turtle.Turtle()
pk = turtle.Turtle()
po = turtle.Turtle()
po.speed(0)
pl.ht()
pk.ht()
pl.color("red")
pk.color("green")
pk.pu()
po.pu()
pl.pu()
po.goto(-200,0)
po.pd()
po.goto(200,0)
po.goto(200,200)
po.goto(200,-200)
po.ht()
pl.goto(-200,-100)
pl.st()
pk.goto(-200,100)
pk.st()
pl.pd()
pk.pd()
pk.speed(1)
pl.speed(1)
while pl.xcor() < 200 and pk.xcor() < 200:
pl.fd(random.randint(20, 40))
pk.fd(random.randint(20, 40))
if pk.xcor() > pl.xcor():
pk.pu()
pk.goto(-100,100)
pk.write("Luigi time" , font = ('Comic Sans MS' , 36 , 'bold'))
elif pl.xcor() > pk.xcor():
pl.pu()
pl.goto(-100,-100)
pl.write("Mario time" , font = ('Comic Sans MS' , 36 , 'bold'))
elif pk.xcor() == pl.xcor():
po.pu()
po.goto(-100,0)
po.write("It`s a tie!" , font = ('Comic Sans MS' , 36 , 'bold'))
pl.ht()
pk.ht()
po.ht()
turtle.mainloop()