美文网首页
turtle race

turtle race

作者: Mr洋1 | 来源:发表于2019-12-06 23:47 被阅读0次
RACE
#!/bin/python3

from turtle import *
from random import randint
penup()
speed(0)
goto(-140,140)

for step in range(15):
  write(step,align='center')
  right(90)
  for j in range(15):
    forward(5)
    pendown()
    forward(5)
    penup()
  backward(150)
  left(90)
  forward(20)
  

ada =Turtle()
bob = Turtle()
cim = Turtle()
Dog = Turtle()
ada.shape('turtle')
bob.shape('turtle')
cim.shape('turtle')
Dog.shape('turtle')
ada.color('red')
bob.color('blue')
cim.color('green')
Dog.color('yellow')
ada.penup()
bob.penup()
cim.penup()
Dog.penup()
ada.goto(-150,100)
for i in range(5):
  ada.right(360/5)
bob.goto(-150,70)
for i in range(7):
  bob.right(360/7)
cim.goto(-150,40)
for i in range(5):
  cim.left(360/5)
Dog.goto(-150,10)
for i in range(7):
  Dog.left(360/7)
for turn in range(100):
  ada.forward(randint(1,5))
  ada.pendown()
  bob.forward(randint(1,5))
  bob.pendown()
  cim.forward(randint(1,5))
  cim.pendown()
  Dog.forward(randint(1,5))
  Dog.pendown()


  
1

相关文章

网友评论

      本文标题:turtle race

      本文链接:https://www.haomeiwen.com/subject/lqyygctx.html