That was scary!

There I sat, after longer than usual. I was waiting for the small population to stabilize. I’d just fixed a problem that had been there for weeks and months, a subtle bug I just hadn’t noticed. Fixing it meant that my little digital creatures, called “Figures,” would behave differently. Maybe the fix would break the system. Maybe they wouldn’t be able to stabilize anymore. Maybe the entire concept has been fundamentally flawed from the beginning. Maybe it’s all been a waste of time.

And then…

When running the very small population, before fixing the bug I talked about in the previous entry, I’d sometimes get a population that would make one or two children, and then die out. Other times I get a partly stable population that could generate around 300,000 children before everybody died. Usually, after between 10 and twenty minutes, I’d get a fully stable population, one that could make millions or billions of children, and never show the slightest sign of getting anywhere close to dying out on me.

After fixing a problem with saving a population to, and restoring a population from, a file, one of my tests showed me that I’d forgotten to update one of the fields. This wasn’t during save and restore, this was something that was meant to be happening as part of the main system. The funny thing is, the output that made me check on it wasn’t a good test for it. Even after I fixed the problem, most of the time, the output from the tests for save and restore still showed that that field wasn’t getting set.

It turns out that the only time I see that field getting updated, is when the population is at least partly stable, at least able to make a few hundred thousand children. I had to write other tests to make sure everything that was meant to happen was really happening. After all that was finished, I let it run, watching to see if the updated figures could figure out how to copy themselves.

Time passed, and time passed. After fifteen minutes, I’d seen populations that could make one or two children, and then die. I ran it again, and after another twenty minutes, another few children were born, and the population died out again. I ran it again, determined that I could wait until it at least got partly stable. After more than a half hour, I finally got a fully stable population.

They’re running in the background right now. They’ve run for well over three hours without dying out, and have created more than a billion children.

The fix didn’t break it!

Leave a Reply