Commit e5758c52 by BellCodeEditor

save project

parent 5c190c37
Showing with 8 additions and 4 deletions
......@@ -14,23 +14,27 @@ pen.backward(150) # 后退
pen.down()
def tree(n):
if n >= 10:
lenth = random.randint(5,15)
if n >= 0:
lenth = random.randint(2,16)
if n <= 12:
pen.pensize(lenth /3)
color = random.choice("snow","lightcoral")
color = random.choice(("snow","lightcoral","lightcoral"))
pen.color(color)
else:
pen.color(sienna)
pen.color("sienna")
pen.pensize(n /10)
angle = random.randint(5,40)
# angle_1 = n /4
pen.forward(n)
# pen.left(angle -angle_1)
pen.left(angle)
# if n > 50:
tree(n -lenth)
# pen.right((angle -angle_1) *2)
pen.right(angle *2)
# if n > 50:
tree(n -lenth)
# pen.left(angle -angle_1)
pen.left(angle)
pen.up()
pen.backward(n)
......
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