Commit b2700a37 by BellCodeEditor

save project

parent 6e5b13f3
Showing with 19 additions and 8 deletions
......@@ -8,14 +8,25 @@ w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
def tree(n):
if n>=50:
pen.speed(20)
if n>=0:
if n<=12:
color_list=["snow","lightcoral"]
color=random.choice(color_list)
pen.color(color)
pen.pensize(n/3)
else:
pen.color("sienna")
pen.pensize(n/10)
pen.forward(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
pen.right(30)
pen.penup()
angle=random.randint(0,30)
length=random.randint(1,15)
pen.right(angle)
tree(n-length)
pen.left(2*angle)
tree(n-length)
pen.right(angle)
pen.up()
pen.backward(n)
pen.down()
......@@ -28,5 +39,5 @@ pen.down()
tree(100)
tree(60)
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