Organism News
October 9th, 2006
While running a test of our organism flash project, and in particular studying my brand new Bee and Beehive behaviour, something which shouldn’t have been possible occurred. With a theoretical maximum of 3 bees, a fourth bee appeared. Believing this to be an interesting fluke, I was proven wrong again when a fifth and sixth bee appeared over time.
Possible Explanation
The musings of someone staring at ACTIONSCRIPT CODE:
Of course, there is a reasonable explanation. There is a time delay between creating a new bee after one dies, and should two die in quick succession, the hive notices that two have died perfectly normally. So the hive creates a new one, and waits to respawn the second. But what happens if another bee dies during this time? The hive counts 2 dead again, creates another, and then at some point one of the new bees dies too quickly, and again the hive is on 2. Three more are created, with a fourth of the new ones still flying about. The extra bee can be accomodated forever because every bee will report when it dies to the hive, that the total number are one down, which to the hive means 3 - 1 = 2 (create a new bee). A seventh has appeared while I typed this, scary…
While watching a trace of the number of bees the hive THINKS there are and the number actually onscreen, it is possible for the hive to say 2 while there are 3.
I’m not sure how to stop this, whether I can, or indeed if I WANT to stop this from happening. And finally, it seems I can’t get it to happen again, so maybe this IS a freak occurrence. I also assume, that the larger the number of bees, the more likely this event is to become.
UPDATE: With patience, it did happen within flash and I watched as the trace of the number said 2 alive, while 3 were flying and therefore it created another, fourth bee.
Thinking about it, the simple solution would be to make sure a bee can’t die faster than the hive can keep count, currently the hive takes 8 seconds to cycle around its activities twice (spawn 2 bees) and also, 8 seconds is the shortest lifespan of a bee. Unfortunately, while this is good for 3 bees, any more and the shortest lifespan will need to be more than 12, 16, 20 etc. The hard solution would be to replace the register of bees in the hive, and replace it with an actual counting of each bee every time it checks to see if any are needed to be spawned.
Add a Comment
The flash actionscript behind this is flexible enough to allow for any size
puzzle to be created and jumbled as many times as I like. In addition to this,
the difficulty of rotating pieces is also a feature.