Pat O'Sullivan Department of Mathematics and Computer Studies Mary Immaculate College, Limerick, Ireland | |||||||
General Information Student Resources and Information Interests |
There is endless fun to be had with recursion. |
to inspi :a :d fd 20 rt :a inspi :a+:d :d end |
to staral :n if :n>300 [stop] fd :n rt 144 staral :n+5 end |
to starshrink :n if :n<10 [stop] lt 18 star :n starshrink :n-15 end |
to star :n repeat 5 [fd :n rt 144] end |
to treefrac :x if :x<2 [stop] fd :x lt 45 fd :x treefrac 2*:x/3 ;A "mini-tree" growing at the tip of the Y. bk :x rt 90 fd :x treefrac 2*:x/3 bk :x lt 45 bk :x End |
to fern :x if :x<3 [stop] fd :x/12 lt 45 fern 6*:x/16 rt 45 ;There is a "mini-fern" growing at an angle to the main stalk here. fd :x/12 rt 45 fern 6*:x/16 lt 45 fd :x/12 lt 45 fern 5*:x/16 rt 45 fd :x/12 rt 45 fern 5*:x/16 lt 45 fd :x/12 lt 45 fern 4*:x/16 rt 45 fd :x/12 rt 45 fern 4*:x/16 lt 45 fd :x/12 lt 45 fern 3*:x/16 rt 45 fd :x/12 rt 45 fern 3*:x/16 lt 45 fd :x/12 lt 45 fern 2*:x/16 rt 45 fd :x/12 rt 45 fern 2*:x/16 lt 45 fd :x/12 lt 45 fern :x/16 rt 45 fd :x/12 rt 45 fern :x/16 lt 45 fern :x/16 bk :x end |