from turtle import from random import

from math import *

def tree(n,l):

pd()# Writing

# Shadow effect

t = cos(radians(heading()+45))/8+0.25

pencolor(t,t,t)

pensize(n/3)

forward(l)# Draw a branch

if n>0:b = random()*15+10 # Right branch deflection angle

c = random()*15+10 # Left branch deflection angle

d = l*(random()*0.25+0.7) # The length of the next branch

# Turn right at a certain angle , Draw the right branch

right(b)

tree(n-1,d)

# Turn left at a certain angle , Draw left branch

left(b+c)

tree(n-1,d)

# Turn around

right(c)

else:

# Painting leaves

right(90)

n=cos(radians(heading()-45))/4+0.5

pencolor(n,n*0.8,n*0.8)

circle(3)

left(90)

# add to 0.3 Times of falling leaves

if(random()>0.7):

pu()

# Falling

t = heading()

an = -40 +random()*40

setheading(an)

dis = int(800*random()*0.5 + 400*random()*0.3 + 200*random()*0.2)

forward(dis)

setheading(t)

# Painting leaves

pd()

right(90)

n = cos(radians(heading()-45))/4+0.5

pencolor(n*0.5+0.5,0.4+n*0.4,0.4+n*0.4)

circle(2)

left(90)

pu()

# return

t=heading()

setheading(an)

backward(dis)

setheading(t)

pu()

backward(l)# return

bgcolor(0.5,0.5,0.5)# Background color

ht()# hide turtle

speed(0)# speed 1-10 gradual ,0 Fastest

tracer(0,0)

pu()# pen-up

backward(100)

left(90)# Turn left 90 degree

pu()# pen-up

backward(300)# back off 300

tree(12,100)# recursion 7 layer

done()

code

from turtle import from random import

from math import *

def tree(n, l):

pd()

t = cos(radians(heading() + 45)) / 8 + 0.25

pencolor(t, t, t)

pensize(n / 4)

forward(l)

if n > 0:

b = random() 15 + 10

c = random()15 + 10

d = l (random()0.35 + 0.6)

right(b)

tree(n - 1, d)

left(b + c)

tree(n - 1, d)

right(c)

else:

right(90)

n = cos(radians(heading() - 45)) / 4 + 0.5

pencolor(n, n, n)

circle(2)

left(90)

pu()

backward(l)

bgcolor(0.5, 0.5, 0.5)

ht()

speed(0)

tracer(0, 0)

left(90)

pu()

backward(300)

tree(13, 100)

done()

Technology
©2019-2020 Toolsou All rights reserved,
2020 The 11th National Blue Bridge Cup C/C++b Group summary ( Completion ) Review of the most complete computer network principles in history vue-cli 3 VUE Scaffold project construction ( Detailed explanation ) solve Vue+TypeScript Under development TS Don't recognize this.$refs The question of Vue Using the function of anti chattering and throttling How to use division operation in relational algebra SQL Statement representation ?copy-webpack-plugin Copy and compress files avue The use of dictionaries in English Teaching girls to learn Java: What is? Java?python Code painting Cherry Blossom -python Draw cherry tree code Specific code introduction