aUCBLogo Demos and Tests / tree3
to tree3 [level 7][size 100][angle 0]
if level==0 [stop]
ifelse level==1 [setPenColor "white][setPenColor "darkgreen]
setPenSize ((List level level)/8)^1*size/6
PenDown
fd size
local [a b c]
a=angle+random 30
b=angle+random 30
c=angle+random 30
lt 80+a
tree32 level-1 size/3 angle
rt 70+a+b
(tree3 level-1 size*2/3 angle)
rt 90-b+c
tree32 level-1 size/3 angle
lt 80+c
PenUp
bk size
end
to tree32 level size angle
if level==0 [stop]
ifelse level==1 [setPenColor "white][setPenColor "darkgreen]
setPenSize ((List level level)/8)^1*size/6
PenDown fd size
local [a b c d]
a=angle+random 30
b=angle+random 30
c=angle+random 30
d=angle+random 30
rt 80+a
(tree3 level-1 size/3 angle)
lt 70+a+b
tree32 level-1 size*2/3 angle
lt 90-b+c
(tree3 level-1 size/3 angle)
rt 40+c+d
(tree3 level-1 size*4/5 angle)
rt 40-d
PenUp
bk size
end