Commit f90052c3 by BellCodeEditor

auto save

parent 576b5884
Showing with 37 additions and 0 deletions
import turtle
import random
p = turtle.Turtle()
p.color('sienna')
p.lt(90)
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat')
def tree(n):
if n>=0:
a=random.randint(0,30)
c=random.randint(1,15)
if n<=12:
colorlist=["snow","lightcoral"]
color=random.choice(colorlist)
p.pencolor(color)
p.pensize(n/3)
else:
p.pencolor("sienna")
p.pensize(n/10)
p.fd(n)
p.right(a)
tree(n-c)
p.left(2*a)
tree(n-c)
p.right(a)
p.up()
p.bk(n)
p.down()
p.up()
p.bk(200)
p.down()
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