Commit af7ad1f3 by BellCodeEditor

save project

parent b5b506af
Showing with 10 additions and 7 deletions
import turtle
import random
def tree(n):
if n>=50:
if n>=0:
a=random.randint(0,30)
b=random.randint(1,15)
pen.forward(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
pen.right(30)
pen.right(a)
tree(n-b)
pen.left(2*a)
tree(n-b)
pen.right(a)
pen.up()
pen.backward(n)
pen.down()
......@@ -21,5 +24,5 @@ w.bgcolor('wheat') # wheat小麦
# 移动到起点
pen.lt(90)
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