Simple artificial life program source code

I am finishing up my reading of ‘The Magic Machine: A Handbook of Computer Sorcery‘ and there were only two programs left to write. I thought I’d wipe the first one out in a day. Heh, it took three.

In a chapter of the book the author discusses early attempts at genetically evolving artificial life. He gives a rough algorithm and states he had all kinds of critters running around in just a few hundred generations. I loosely wrote a program based on his algorithm. 150,000+ cycles, and 36 hours on my computer later, no evolution. I don’t know how he did it? I couldn’t get the algorithm in the book to produce any interesting results.

I did today get a program that has bugs that learn to stay on and follow food lines drawn in the window. It takes about 1500 days ( cycles ) for them to achieve this universally. The source code is linked to below.

Here’s what I learned in my attempts at a very simple genetic program.

If you place food randomly there is nothing to learn. You just end up with a population of stupid bugs. Adjusting the food nutrient content worked better than adjusting the amount of food for controlling population levels and for evolution. Creating more food to meet the population just created lots of stupid bugs. ( I wonder if there is a real life lesson in that? )

If you adjust the bugs DNA when they find food, not just their energy levels they learn much faster.

I hope to do some more complex and interesting evolution programs soon.

Source Code:
Bugs.java

See also
Evolutionary AI for more information and several useful links and papers to get you started.
SantaFe Ants

You must be logged in to post a comment.