Commit dce61408 by BellCodeEditor

auto save

parent 470f3703
Showing with 5 additions and 3 deletions
...@@ -3,6 +3,7 @@ import random ...@@ -3,6 +3,7 @@ import random
pen = turtle.Turtle() pen = turtle.Turtle()
pen.color('sienna') pen.color('sienna')
pen.speed(0)
# 画布大小 # 画布大小
w = turtle.Screen() w = turtle.Screen()
w.bgcolor('wheat') # wheat小麦 w.bgcolor('wheat') # wheat小麦
...@@ -10,10 +11,11 @@ w.bgcolor('wheat') # wheat小麦 ...@@ -10,10 +11,11 @@ w.bgcolor('wheat') # wheat小麦
# 移动到起点 # 移动到起点
pen.left(90) pen.left(90)
pen.up() pen.up()
pen.backward(150) # 后退 pen.backward(200) # 后退
pen.down() pen.down()
def tree(n): def tree(n):
if n >= 0: if n >= 0:
if n <= 12: if n <= 12:
color_list = ['snow','lightcoral'] color_list = ['snow','lightcoral']
...@@ -28,7 +30,7 @@ def tree(n): ...@@ -28,7 +30,7 @@ def tree(n):
pen.right(30*angle) pen.right(30*angle)
length = 1.5 * random.random() length = 1.5 * random.random()
tree(n-10*length) tree(n-10*length)
pen.left(60*length) pen.left(60*angle)
tree(n-10*length) tree(n-10*length)
pen.right(30*angle) pen.right(30*angle)
pen.up() pen.up()
...@@ -36,5 +38,5 @@ def tree(n): ...@@ -36,5 +38,5 @@ def tree(n):
pen.down() pen.down()
tree(60) tree(75)
turtle.done() 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