Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3617034
  • 博文数量: 365
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2522
  • 用 户 组: 普通用户
  • 注册时间: 2019-10-28 13:40
文章分类

全部博文(365)

文章存档

2023年(8)

2022年(130)

2021年(155)

2020年(50)

2019年(22)

我的朋友

分类: Python/Ruby

2022-12-26 16:22:38

# 画{BANNED}中国第一层

seth(-120)

for i in range(10):

    fd(12)

    right(2)

penup()

goto(0, 150)

seth(-60)

pendown()

for i in range(10):

    fd(12)

    left(2)

seth(-150)

penup()

fd(10)

pendown()

for i in range(5):

    fd(10)

    right(15)

seth(-150)

penup()

fd(8)

pendown()

for i in range(5):

    fd(10)

    right(15)

seth(-155)

penup()

fd(5)

pendown()

for i in range(5):

    fd(7)

    right(15)

# 画第二层

penup()

goto(-55, 34)

pendown()

seth(-120)

for i in range(10):

    fd(8)

    right(5)

penup()

goto(50, 35)

seth(-60)

pendown()

for i in range(10):

    fd(8)

    left(5)

seth(-120)

penup()

fd(10)

seth(-145)

pendown()

for i in range(5):

    fd(10)

    right(15)

penup()

fd(10)

seth(-145)

pendown()

for i in range(5):

    fd(12)

    right(15)

penup()

fd(8)

seth(-145)

pendown()

for i in range(5):

    fd(10)

    right(15)

penup()

seth(-155)

fd(8)

pendown()

for i in range(5):

    fd(11)

    right(15)

......    

星星

五角星主要代码实现如下:

pensize(2)

pencolor("yellow")

penup()

goto(x, y)

pendown()

begin_fill()

fillcolor("yellow")

for i in range(5):

    left(72)

    fd(size)

    right(144)

    fd(size)

end_fill()

帽子

帽子主要代码实现如下:

penup()

goto(-30, -120)

pencolor("white")

pendown()

fillcolor("white")

begin_fill()

fd(30)

circle(4, 180)

fd(30)

circle(4, 180)

end_fill()

penup()

goto(-25, -115)

seth(75)

pendown()

fillcolor("red")

begin_fill()

for i in range(5):

    fd(6)

    right(20)

seth(-10)

for i in range(5):

    fd(8)

    right(15)

seth(145)

for i in range(5):

    fd(5)

    left(2)

seth(90)

for i in range(5):

    fd(1)

    left(2)

seth(-90)

for i in range(4):

    fd(4)

    right(6)

seth(161)

fd(30)

end_fill()

pensize(1)

pencolor("white")

袜子

袜子主要代码实现如下:

penup()

goto(-20, 80)

pencolor("white")

pendown()

begin_fill()

fillcolor("white")

fd(25)

circle(4, 180)

fd(25)

circle(4, 180)

end_fill()

penup()

goto(-15, 80)

pendown()

begin_fill()

fillcolor("red")

seth(-120)

fd(20)

seth(150)

fd(5)

circle(7, 180)

fd(15)

circle(5, 90)

fd(30)

seth(160)

fd(18)

end_fill()

penup()

seth(0)

goto(70, -240)

蝴蝶结

蝴蝶结主要代码实现如下:

penup()

pencolor("#f799e6")

goto(x, y)

seth(80)

pendown()

pensize(2)

circle(5)

seth(10)

fd(15)

seth(120)

fd(20)

seth(240)

fd(20)

seth(180)

fd(20)

seth(-60)

fd(20)

seth(50)

fd(20)

seth(-40)

fd(30)

seth(-130)

fd(5)

seth(135)

fd(30)

seth(-60)

fd(30)

seth(-150)

fd(6)

seth(110)

fd(30)

雪花

雪落效果主要代码实现如下:

screen.delay(0)

t = Turtle(visible = False,shape='circle')

t.pencolor("white")

t.fillcolor("white")

t.penup()

t.setheading(-90)

t.goto(r.randint(-width/2,width/2),height/2)

stars = []

for i in range(200):

    star =跟单网gendan5.com t.clone()

    s =r.random() / 3

    star.shapesize(s,s)

    star.speed(int(s*10))

    star.setx(r.randint(-width/2,width/2))

    star.sety(height/2 + r.randint(1,height))

    star.showturtle()

    stars.append(star)

while True:

    for star in stars:

        star.sety(star.ycor() - 8 * star.speed())

        if star.ycor()<-height/2:

            star.hideturtle()

            star.setx(r.randint(-width/2,width/2))

            star.sety(height/2 + r.randint(1,height))

            star.showturtle()

阅读(480) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~