Course Projects

Extracurricular projects for fun

Mini-projects

Scriptbots

This project is an Open Source Evolutionary Artificial Life simulation of carnivore/herbivore dynamics. Agents (made up of DNA, array of sensors and actuators) reproduce over time, gather food, and hunt each other. Communication, speciation, cooperation, and predator-prey cycles, emerge in the simulation through process of natural selection. I am currently working on next version that will support emergence of alturism and sexual selection.

Above: Video of most recent results (version 3)

Above: plot of numbers of predators and prey in the system. It looks very similar to predator prey systems that we observe in the real world, I was very happy to see it emerge from the simulation.

Above: Version 2 of the simulation, Jan2010

Above: Version 1 of the simulation, Aug2009 (much different from the current version but shown for completness)



Description

This is a project I've been working on for a while. In short, it attempts to simulate evolution of organisms that I think of as something like fishes in a primordial soup.

Input/Output of agents Every agent in the simulation has an array of sensors. There are 3 eyes (2 in front and 1 in back) that sense the amount of Red, Green and Blue light in their cone of vision, and also contain a proximity sensor. There is a smell sensor that responds more if there are many agents around, and a sound sensor that responds to the amount of movement. There is a food sensor that senses the amount of food on the ground, and finally a health sensor that indicates how healthy the agent is. The outputs control the movement, and the amount of Red, Green, and Blue light that an agent is to emit at any point in time.

Dynamical system that carries input->output

The input->output mapping is handled by a rule system that I implemented for every agent, and can be essentially thought of as a recurrent multilayer perceptron. The parameters of every "brain" are inhereted from generation to generation. Note that the mapping is not strictly feed-forward but is a dynamical system, and the agents also have memory bins where they can choose to store values between 0 and 1.

The parameters of the brain are fixed in every agent throughout its life, so learning only happens between generations.

Environmental rules

There are two types of agents living in the environment: Herbivors and Carnivors. Herbivors gain health by eating food on ground, and carnivors gain health by eating herbivors. The health slowly decreases, so agents that are not successful in obtaining food die off. The food grows back slowly over time at random positions. When agents accumulate enough food, they spawn two children using asexual reproduction. Every couple of iterations, two successful agents are also picked and their offspring is formed using sexual reproduction with crossover and mutation.

Emergent behavior

I encourage you to watch the video of version 3 that is posted on the right for demonstration of the dynamics that emerges. Examples of some interesting behaviors that I observed:

1. The carnivors develop hunting/steering techniques very quickly by using their proximity sensors.
2. The carnivors start to recognize other carnivors that are most likely their close genetic relatives by using color. For example, carnivors that emit blue will start to avoid eating blue things
3. The herbivors develop behavior where they calmly collect food, but start running if there is a lot of movement around them, or if they sense the color of their predators.
4. The herbivors can sometimes be seen to temporarily impersonate the carnivors by emitting the same colors and so prevent being eaten due to behavior #2 (above).

Code

The entire code is an Open Source Visual Studio 2008 C++ project, and can be found on this dedicated Project Page

evolution predator prey communication hunting social