July 28th, 2007


(no subject)


I woke up early (on a Saturday!), and I figured I'd work a little bit on organizing a collection of game-related code that I'm making available in case I want to use it for PyWeek5.

I moved some stuff around, brought in some code that had been working (Voronoi/Delaunay stuff, which I used to make pictures like this and this, if you recall). In order to make it work with my new packaging, I discarded the vector library that the code was using in favor of my new vector library. Might as well have everybody using the same thing, right?

But no.

The test code that had been working previously was choking - getting into an infinite loop. I tried to figure out what was wrong - I knew I was using floating point numbers instead of integers, and there were a few other small changes that I made. I spent several hours chasing one weird thing after another. Most of that Voronoi code was stuff I lifted from a reference book, and that was lifted in turn from somebody else's publication (which is just fine, I tracked down the original publication, and it went into "orientable manifolds", which was a little much for a Saturday morning, but I managed to understand what the authors were presenting).

After quite a long time of drawing diagrams with curvy arrows for "next" pointers, I figured out that the problem was that the original vector library defined "norm" as the length of the vector, and I defined it as the magnitude of the vector. Python was perfectly happy doing a less-than comparison between a vector object and a floating point number, so no errors popped up there.

That's way too much geekery for this early in the morning. I'm going to maybe cut some blackberries. Or not.