Created by LCSI MicroWorlds



Procedures Page

Project Author: Rupert Russell
Date: 26 April 2001
;to tree procedure modified from original found at: http://www.microworlds.com/library/math/recursive/index.html

to tree  :length :ang :st
 wait delay
 if :length < :st [stop]                  ;bail out clause
 fd :length
 lt :ang
 tree :length / 2 :ang :st                ;recursive call
 rt :ang
 tree :length  / 2  :ang :st              ;recursive call
 rt :ang
 tree :length / 2  :ang :st               ;recursive call
 lt :ang
 bk :length
end

to draw_tree
 pd
 snapshot                                 ;copy current background
 ifelse delay = 0 [ht] [st]               ;if delay = 0 ht else st
 tree height angle detail
 st
end

to seed :angle
 ht                                       ;hide turtle for maximum drawing speed
 if :angle > 50 [stop]                    ;bail out clause
 make "angle :angle + 10                  ;increment the value of angle by 10
 tree height :angle detail
 seed :angle                             ;recursive call to seed procedure
 st
end



Created: April 26, 2001
Last modified: September 6, 2006
rupert at rupert dot id dot au
URL:  http://www.rupert.id.au/tutorials/microworlds/tree.html