TREE SOURCE CODE
Turtle Procedures Observer Procedures

turtles-own
[current-depth]

to tree
treestep
end

to treestep
if current-depth = 0
[stop]
setcurrent-depth current-depth - 1
fd dist
hatch [rt angle + (random variation)
- ((random variation)
/ 2) treestep]
hatch [lt angle + (random variation)
- ((random variation)
/ 2) treestep]
die
end

to grow
setcurrent-depth current-depth - 1
fd dist
hatch [rt angle + (random variation)
- ((random variation)
/ 2)]
hatch [lt angle + (random variation)
- ((random variation)
/ 2)]
die
end

to setup
ca
crt 1
ask-turtles
   [setxy X-coord Y-coord setc green pd
   setcurrent-depth depth
   seth 0]
end