Friday, December 12, 2003
revising CA patterns

In the process of cleaning up the CA code, I fixed a bug, and also made the whole thing run more "true," in that the universe is circular. I just make the circle bigger for longer runs so that the pattern doesn't run into itself.

I discovered that some patterns I first thought interesting were not so much, at least for a single bit seed. I'll leave it as an exercise for the user to figure out which ones. Incidentally, it's really easy to use the code to do limited runs over all 256 rules and eyeball the patterns. It's a quick way to get a feel as to how they all work.

8:55:50 AM    comments ()  trackback []  

funny how

Funny how all you have to do is put some code on a web server and point at it to start seeing all of the weak bits.

As soon as I put the 1D CA code up, I started being more critical with the code. When I first wrote it, all I really wanted was to run the rules, and I didn't really care how nice the code was, I just cared about the patterns that came out.

But now that I put the code out there, I care deeply about how it looks and works. "Why did I do it that way?" "Is that bit re-entrant?"...

I remember writing some example code for the first Win32 SDK. In it, I wrote a helper function to make things clearer. I tested it of course, but only in the way that I expected it to be used. This was EXAMPLE code, right? Certainly people would only use it learn the API, and then write their own stuff. Certainly people would notice that the helper function wasn't going to work the second time you called it.

Yeah, you can all see the stupidity of that statement, and you know exactly what happened.

People stole the code directly. Of course, I know now that that's one of the most common uses of example code. Hell, I do it myself. But my bug now became everyone's bug. Eventually, someone else took over the sample code, and his bit of maintenance consisted of doing a search and replace of his username for mine. Didn't actually fix anything.

Last time I checked, it was still the same code I wrote.

Ever since then, I draw a strong distinction between the code that lives in the deep dark recesses of my hard drive, and the code I bring out for the light of day. Yeah, I should write all code to the same stellar standards. I believe that as well. But you and I both know that it doesn't work that way. No matter how many times a really wonderful bit of code started from a dreadful hack, we still create quick little dreadful hacks. Why? Because they're useful. Which is also precisely why they grow into monstrosities.

8:46:41 AM    comments ()  trackback []