Fri, 3 Apr 2009
EnumGenome, Beings, Bodies, Energy, Heartbeat, and Hunger Nuance in the Cauldron
« The Generic Watchmaker | Main | Rearrangement, in Preparation » Posted by at 5:14 PM in /
Lots of things to talk about in this podcast, because in the couple of days I've had to work on things I could work quickly on the things I had already thought out in the meantime. I'll be presenting the blind watchmaker to a group of friends called the JavaKnights here in NL soon, so I built the presentation and now I'm working to get a convincing demo.
First there is the enum genome, which has now evolved into a genome that holds a gene for every combination of a group of enumerations. The number of genes can easily be made much larger now because instead of one-dimensional with one enum, it becomes an N-dimensional hypercube of genes. Enums are nice when you're coding because you can represent states like FORWARD, BACKWARD, LEFT, RIGHT, combined with EXCITED, CALM, etc.
Then I expand on how Java Generics are being used to create a watchmaker that is truly blind. There is a Body class, an Energy class and a class representing the World. The blind watchmaker is completely in the dark about what these classes contain. Generics enforce blindness. I'm tempted to call it the Generic Watchmaker.
The heartbeat was introduced to allow for something that could be called "ambient behavior", which in the case of darwin at home has the Fabric body experiencing physics. The blind watchmaker executes genes when the heart beats, and in between, the experienceTime() method is called so that the ambient behavior (physics) can act. The heartbeat delay is controlled by behavior classes, which might reflect a level of emergency.
Being is the class that holds the generic things which are evolving. Beings hold the body, the genome, and something new: an energy repository. People coding with the blind watchmaker are responsible for creating an energy class, and make an implementation of the repository that can hold it.
Every instruction in the behavior classes return energy objects, which is extracted from the repository, showing how much energy the instruction costs. Beings can be fed energy, but how do we decide when to feed the being? Here we revisit the Nuance class, since the being is set up to express its degree of hunger to the world. If the being is able to get some food where its body is, it's lucky and it will be fed energy extracted from the world.
To make the programming tight, there is now an annotation called Energy so that you can create an energy class and then annotate it, which allows the blind watchmaker to check that all the instruction methods return one of your energy objects.
Evolution by mutation, like the code has been doing in darwin at home so far, can now be done with a class of the bind watchmaker called Cauldron. It holds a population of beings who are mutating and competing, sortable by fitness.
But now with the EnumGenome and it's many individual genes, the door is open to implement gene crossover!
Technorati Tags: evolution blind watchmaker java