Commit 6060765a by BellCodeEditor

save project

parent 576b5884
Showing with 39 additions and 0 deletions
import turtle
import random
pen = turtle.Turtle()
pen.color('sienna')
# 画布大小
w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦
pen.speed(0)
def bnm(n):
if n>=0:
q=random.randint(15,30)
w=random.randint(5,10)
e=["snow","lightcoral"]
bnm_qwe= n - w
if bnm_qwe<5:
pen.color(random.choice(e))
pen.pensize(5)
else:
pen.pensize(n/10)
pen.color('sienna')
pen.forward(n)
pen.right(q)
bnm(bnm_qwe)
pen.left(q*2)
bnm(bnm_qwe)
pen.right(q)
pen.up()
pen.backward(n)
pen.down()
# 移动到起点
pen.left(90)
pen.up()
pen.backward(150) # 后退
pen.down()
bnm(60)
turtle.done()
\ No newline at end of file
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