…in which I whine about CAOS and squee about my new house.
I’ve just started my third complete rewrite of the ivy growth logic. The first one failed miserably at even just growing along a relatively horizontal surface. The slightest upward incline threw monkey wrenches into the logic, and my tests eventually revealed that for some reason, the CAOS engine was convinced that for the next several meters (for creatures) or inches (for me) after obst balked at one of those barely-discernable incline changes, the mvsf command would insist on placing the ivy FAR above the awful, scary one-pixel-high obstacle in its path — like ‘way up at adult norn shoulder-height, if not higher.
All of that meant that somehow I had to find a way to make my ivy smart enough to sense what’s ahead of it and choose the location for its next segment without the help of either obst or mvsf. And have I mentioned, I’m just a CAOS beginner? *sigh*
Since then I’ve had to invent new ways of detecting obstacles, and haul out my high school trigonometry skills (of which precious little still survives after all these years) to make the stuff work. The second iteration of the code worked beautifully, as long as the ivy only had to grow toward the left along a floor. For a while I just planted it in various places and watched like a proud parent as it happily navigated up and down the many inclines in C3/DS, until it ran into a wall (where it stopped) or encountered a dropoff (where it also stopped).
But after a while, watching ivy grow leftward gets old, and it runs out of floor. That’s when I discovered that in order to make it turn and grow upward, or to add right-growing capability, I was going to end up multiplying what already amounted to hundreds of lines of code by however many different directions it needed to know how to travel in. Ouch. And the code was so complex already that just converting it to go to the right (changing signs of X-coordinates, adding Xs instead of subtracting, that sort of thing) was a huge headache. Making it climb (transposing of Xs with Ys AND various changing of signs and plus/minus operations) was a nightmare. And since I was always one of those coders who write the code and THEN figured out what the flow chart should look like (to the consternation of my instructors), I couldn’t even begin to modularize the mess I had created into any sort of reusable subroutines.
To further complicate matters, I had put the ivy away for a few weeks while I worked on Norngirl’s Toxes, and then had to completely reinstall C3/DS when it all suddenly decided to stop working. That took a while, because it happened when there was a lot going on at work and I didn’t have much time to spend on it. And then just about the time I had it working again, we decided to buy a house, which is VERY distracting (but in a very happy sort of way). All of that time away from my code meant that when I sat down to work on it again, I could barely tell what I was doing in all the tangled spaghetti mess of it, much less try to expand on it.
So today I put away the computer and reacquainted myself with my long-lost friends PENCIL and PAPER. And after filling 7 pages with scribbles and diagrams and notes, I’ve got the foundation laid for a more organized and robust approach to the logic of growing ivy leftward, in a way that will make it simpler to expand into growing rightward, and then upward on a wall to the right, or upward on a wall to the left, and maybe even, eventually, along a ceiling.
I have no idea how long it will take to convert it from graphite to electrons and get it all translated into actual CAOS code, since most of my free time for the next few months will be devoted to the process of moving (*groan*). Our new house is awesome, though. It’s out in the country, with lots of space and fresh air, and this amazing back yard:
Oh, the CAOS I can code with a view like that! So be patient with me; there will be more agents (including this confounded ivy) coming in the future.
(If you want them sooner, you’re welcome to come help me pack!)