import turtle
w=turtle.Screen()
def Tri(t, order, size):
if order==0:
t.forward(size)
t.left(120)
t.forward(size)
t.left(120)
t.forward(size)
t.left(120)
else:
t.pencolor('red')
Tri(t, order-1, size/2, color-1)
t.fd(size/2)
t.pencolor('blue')
Tri(t, order-1, size/2, color-1)
t.fd(size/2)
t.lt(120)
t.fd(size)
t.lt(120)
t.fd(size/2)
t.lt(120)
t.pencolor('green')
Tri(t, order-1, size/2,color-1)
t.rt(120)
t.fd(size/2)
t.lt(120)
誰でもこの問題を解決できますか?
次のような特定の深さで色を持つシェルピンスキー三角形が必要です。
特定の深さで三角形の色を変更する方法がわかりません。
前もって感謝します!