Sunday, June 1, 2008

MicroPond v2


In MicroPond v1, there's food and then there's critters. The evolution of the critters is simply driven by competition between the critters for food, and the food does not evolve.

For the second version, I wanted the critters to eat each other in the hopes that this would drive critter evolution naturally. My thought was that the evolution of predators should drive the evolution of natural defenses, which should in turn drive smarter predators.

Additionally, I planned for the "critters" in MicroPond V2 to develop a richer instruction set. While one goal I had for MicroPond V1 was to create an evolving ALife simulation that could be understood by a non-programmer, I hoped for more interesting instruction sets to evolve in V2. In V2, some instructions map to segments, while others do not. For example, while there's a Photosynthesize instruction that maps to a green pixel, an Eat instruction that maps to a red pixel, there are other instructions that don't map to segments at all.

One problem I faced was coming up with an "attack" instruction that allowed for intelligent strategies to develop. If you can't defend yourself from attack, there's no need for much intelligence on the part of the attacker or prey. My solution was this: a critter gains energy each turn for every exposed Photosynthesize instruction (a green pixel), but the Photosynthesize instruction leaves a critter open to attack. Normally one critter cannot move on top of another, but if a critter attempts to move over another critter's green/photosynthesize segment, it will eat the critter.

One defensive strategy is for a critter to curl up around its photosynthesize instruction, so no part is exposed. Colonies also form, which provides lesser protection.

There are three territories in MicroPond V2: a shaded center square in which photosynthesis operates at reduced efficiency (every time a Photosynthesis instruction executes inside the center square it produces a third of the energy compared to elsewhere), a small square in the lower left that contains randomly placed gray obstacles, with a solid wall on its right side, and the remaining area which is unobstructed and photosynthesis runs at full efficiency.

Also, MicroPond v2 is multithreaded, and so two separate "worlds" run simultaneously. There's no synchronization between the worlds, but it uses my dual-core process to good effect, and it's interesting to see how differently they can develop. I'm curious if this could be a useful metric for the "interestingness" of a particular simulation - let it run several times for a set number of turns and see how different the end result is between runs. Also, in a future version I'd like critters to migrate from one "world" to another.

Finally, there's a pretty nice close-up view in MicroPond v2 that shows the individual "critters", along with their head, orientation, and a bar of their energy level on the tail.

The program can be downloaded here:
http://www.badongo.com/file/9705866

5 comments:

Anonymous said...

I love V1! please post a download link to V2 the other one doesn't work

Anonymous said...

The download link isn't working! Could you please upload it to dropbox or mediafire?

Unknown said...

PLEASE UPLOAD V2 AGAIN! PEOPLE STILL PLAY V1! V3 would be even better! PLZZZ

Unknown said...

PLEASE UPLOAD V2 AGAIN! PEOPLE STILL PLAY V1! V3 would be even better! PLZZZ

Unknown said...

Hi! I am so excited to check this out! Do you play at all with Golly and Conway's Game of Life? There is this rule variant called "Shapeloop" with self-replicating generational patterns that assemble themselves from a genetic code, evolve and die etc. You really might find it interesting if you don't already know it. This is a huge interest and hobby of mine, simulation of evolution through programmatic rules and I have a lot of time considering the problem and analogs for fundamental processes at work in nature. I would love to correspond sometime on the subject. Feel free to send me an email at edgar.bounds@gmail some time. Here is a link to a great Shapeloop thread on the Conway's Life forum:

http://www.conwaylife.com/forums/viewtopic.php?f=11&t=1765

I would definitely check out the regular rules before the "food" version.