Recursion...First Attempt
I have a goal of using cellular autonoma to simulate tree growth. This program is an alpha-draft of that, hyper early on in the development cycle. I am pretty sure none of this code will go onto be used in latter versions, but I learned about recursion and that's a good benefit. It is drawn segment by segment, and each segment calls two more. It recurses (I think that's a word) for a random time (well 50% chance of continuing that branch). I added in the ability to start a segment from where you click, it's kinda fun I think...you can paint with the branches. To get the middle branch to stop drawing new branches just hit the 'o' key. Code after the jump...
Oh and I apologize or the size, it fits poorly on the site, but gives more space to draw with so I feel it's worth it.
I haven't checked to thoroughly for errors, it may falt if it trys to recurse to many times.
Reader Comments