效果展示戳这里
代码
from turtle import *
import numpy as np
reset()
setup(500,500)
screensize(bg='white')
pensize(1.5)
pu()
goto(0,-100)
left(185)
color('black','gold')
begin_fill()
pd()
a = np.random.RandomState(10)
angle = a.rand(6)
angle = angle * 20+85
edge = [20, 30, 30, 25, 50, 70]
for i in range(6):
fd(edge[i])
if i%2 == 0: right(angle[i])
else: left(angle[i])
goto(-180,50)
pu()
goto(-8,-110)
seth(190)
pd()
edge2 = [20, 30, 30, 25, 60, 40]
for i in range(6):
fd(edge2[i])
if i%2 == 0: right(angle[i]+np.random.randn(1))
else: left(angle[i])
left(15)
fd(70)
goto(-180,50)
pu()
goto(-8,-110)
seth(10)
pd()
fd(10)
goto(0,-100)
end_fill()
fillcolor('gold')
begin_fill()
goto(0,-100)
seth(105)
circle(-180,30)
seth(110)
circle(-100,50)
seth(150)
circle(-190,15)
goto(-32,108)
circle(-190,15)
goto(-40,145)
seth(-20)
circle(-180,27)
seth(20)
circle(-100,40)
seth(95)
circle(-190,17)
goto(103,158)
circle(-190,13)
goto(125,175)
seth(-80)
circle(-190,27)
seth(295)
circle(-65,25)
seth(260)
circle(50,30)
seth(285)
circle(-40,60)
goto(117,-5)
goto(110,-9)
seth(-45)
circle(-45,58)
goto(121,-52)
goto(122,-50)
seth(-30)
circle(-35,55)
seth(75)
circle(-50,30)
circle(-4,140)
seth(-95)
circle(-80,40)
circle(-4,180)
goto(125,-110)
seth(-90)
circle(-80,30)
circle(-6,140)
seth(200)
circle(-90,65)
goto(0,-100)
end_fill()
pu()
goto(-32,108)
pd()
fillcolor('black')
begin_fill()
circle(-190,15)
goto(-40,145)
goto(-32,108)
end_fill()
pu()
goto(-40,145)
pd()
seth(-20)
circle(-180,27)
seth(20)
circle(-100,40)
seth(95)
circle(-190,17)
goto(103,158)
fillcolor('black')
begin_fill()
circle(-190,13)
goto(125,175)
goto(103,158)
end_fill()
pu()
goto(117,-5)
pd()
seth(205)
circle(-150,20)
circle(-50,20)
circle(-180,5)
pu()
goto(117,-5)
pd()
goto(110,-9)
seth(-45)
circle(-45,58)
goto(121,-52)
circle(-45,22)
goto(110,-70)
x=110
y=-70
for i in range(5):
x = x-2
if i%2 == 0: y = y+4
else: y = y-4
goto(x,y)
x=100
y=-66
for i in range(3):
y = y-2
if i%2 != 0: x = x+3
else: x = x-4
goto(x,y)
seth(205)
circle(-50,60)
x=100
y=-66
pu()
goto(x,y)
pd()
for i in range(3):
y = y+2
if i%2 != 0: x = x+4
else: x = x-3
goto(x,y)
seth(130)
circle(75,45)
pu()
goto(92,-53)
pd()
seth(95)
circle(-75,25)
pu()
goto(125,-110)
pd()
seth(85)
circle(4,180)
seth(230)
circle(65,30)
seth(60)
circle(50,70)
pu()
goto(45,52)
pd()
fillcolor('black')
begin_fill()
circle(14,360)
end_fill()
pu()
goto(40,50)
pd()
fillcolor('white')
begin_fill()
circle(5,360)
end_fill()
pu()
goto(105,50)
pd()
fillcolor('black')
begin_fill()
circle(14,360)
end_fill()
pu()
goto(97,48)
pd()
fillcolor('white')
begin_fill()
circle(5,360)
end_fill()
pu()
goto(33,20)
pd()
fillcolor('tomato')
begin_fill()
circle(15,360)
end_fill()
pu()
goto(115,17)
pd()
fillcolor('tomato')
begin_fill()
circle(13,360)
end_fill()
pu()
fillcolor('black')
begin_fill()
goto(61,22)
pd()
goto(65,22)
goto(64,20)
goto(61,22)
end_fill()
a=np.sqrt(3)
pu()
goto(62,13)
pd()
seth(240)
circle(-12,120)
pu()
goto(62,13)
pd()
seth(-60)
circle(12,120)
pu()
goto(62,13)
pd()
fillcolor('lightcoral')
begin_fill()
seth(240)
circle(-12,60)
goto(62-6*a,7)
seth(-90)
circle(20,55)
goto(62,-10)
pu()
goto(62,13)
pd()
seth(-60)
circle(12,60)
goto(62+6*a,7)
seth(-90)
circle(-20,55)
goto(62,-10)
end_fill()
hideturtle()