Commit 8650ce76 by BellCodeEditor

save project

parent da9f7c46
Showing with 10 additions and 2 deletions
import turtle
import random
import
l = ["snow","lightcoral"]
def tree(n):
if n >=0:
lenth = random.randint(1,15)
if n <= 10:
pen.pensize(n)
a = random.choice(l)
pen.pencolor(a)
else:
pen.pencolor("sienna")
pen.pensize(n/10)
pen.forward(n)
angle = random.randint(0,30)#随机角度
lenth = random.randint(1,15)
pen.right(angle)
tree(n-lenth)
pen.left(2*angle)
......@@ -25,5 +33,5 @@ pen.left(90)
pen.up()
pen.backward(150) # 后退
pen.down()
tree(50)
tree(100)
turtle.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment