# Problem0 ###### tags: `week9` ```python=1 import turtle as tu def draw(alist,r): global x,y x-=r/2 y+=r/2 tu.penup() tu.goto(x,y) tu.pendown() tu.showturtle() tu.speed(10) for i in range(len(alist)): tu.left(alist[i]) tu.forward(r) tu.setheading(0) cc = [-90,90,90] def chacurve(alist): slist = [] d = 0 while len(alist) > 0: if (alist[1],alist[2]) == (90,90): g2 =alist.pop(0) d+=g2 slist.extend([g2+90,-90,-90,90,0,90,90,-90,-90,90,90,0,90,-90,-90]) d += alist.pop(0) d += alist.pop(0) elif (alist[1],alist[2]) == (-90,-90): g1 =alist.pop(0) d+=g1 slist.extend([g1-90,90,90,-90,0,-90,-90,90,90,-90,-90,0,-90,90,90]) d+= alist.pop(0) d+= alist.pop(0) elif alist[0] == 90: slist.extend([0]) d += alist.pop(0) elif alist[0] == -90: slist.extend([0]) d += alist.pop(0) elif alist[0] == 0: k = d%360 b = sum(slist)%360 slist.extend([k-b]) alist.pop(0) return slist x=-200 y=200 def pic(alist,r): if r <= 2: quit else: draw(alist,r) nlist =chacurve(alist) return pic(nlist,r/2) pic(cc,128) ```