A simple critter is equipped with an artificial brain consisting of only 8 neurons (nerve cells in the brain). It has 6 tentacles (sensors or sensing nerve cells if you like) pointing in three physical directions (forward, left and right). Each nerve can connect to the neurons and the neurons can connect back to neurons according to a network artificially evolved as in the applet you start by pressing the button below. If an object (food or obstacle) is somewhere along its tentacles a sensation feeds to the connected neurons. Two of the neurons are dedicated to feed signals to the two wheels (forward, still or backward) at each instant in time.
One generation lasts 100 steps. Each critter is equipped with an energy reserve lasting 50 steps. Each packet of food (depicted as green dots) supplies another 10 steps worth of energy. Obviously, the critters are initially irrational. The best critters in each generation (the ones with the greatest energy store) get to mate and their genes (specifying the network of connections in their brain) are combined to the offspring which replaces the old generation. Hence, the most suitable brains for the environment are transferred (through recombination and mutation) to the next generation. The results start to shine through after about 10 generations and after another 50 they start to look good. After 1000 generations the critters move around as if they were quite intelligent.Press Start applet to start evolving critters.
A zipped archive with code, class files and javadoc files can be found here.
Java doc index here.