Commit 7e683998 by BellCodeEditor

save project

parent ff572a42
Showing with 18 additions and 7 deletions
import turtle
import random
colors = ["snow","lightcoral"]
def tree(n):
if n >= 50:
if n >= 0:
if n <= 12:
flower_color = random.choice(colors)
pen.color(flower_color)
pen.pensize(n/3)
else:
pen.color("sienna")
pen.pensize(n/10)
pen.fd(n)
pen.right(30)
tree(n-10)
pen.left(60)
tree(n-10)
angle = random.randint(0,30)
length = random.randint(1,15)
pen.right(angle)
tree(n-length)
pen.left(2*angle)
tree(n-length)
pen.up()
pen.right(30)
pen.right(angle)
pen.bk(n)
pen.down()
......@@ -26,7 +37,7 @@ pen.down()
pen.speed(0)
tree(100)
tree(60)
# pen.forward(100)
# pen.right(30)
......
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