All the "animals" work the same way, exploring the map according to their "genes", eating plants (
.) they come across to keep themselves alive, and using excess food to reproduce asexually.
They are rendered according to a simplistic "optimism" measure from most to least "optimistic": A ^ o x X.
An A indicates that the animals genes are such that it will nearly always move forwards, and at the other extreme an X indicates an animal that will almost always turn to the side or backwards.
The simulation includes a "jungle" area in the center where food spawns twice as often as the rest of the world, and what we'd like to see is some "speciation", as one group of animals evolves to take advantage of the jungle by not moving much, and another group roams much more widely looking for the rest of the food.
The animals genes are weights for it turning relative to it's previous facing, with 0 (the first entry in the array) being "straight ahead", the same direction it went in the previous cycle:
7 0 1
6 ↑ 2
5 4 3
If an animal only had a value in position 2, like [0, 0, 42, 0, 0, 0, 0, 0], it would always turn 90° to its right in a tiny square:
→ ↓
↑ ←
With multiple genes, their relative values determine the animals behaviour. If the animal had a the same value for every gene, it would move completely randomly. If an animal's genes were [3, 2, 0, 0, 0, 0, 0, 1] you could imagine rolling a die and counting through the numbers: 1-3 → go straight ahead, 4 or 5 → turn 45° to the right and 6 turn 45° to the left (skipping over all the 0s in the middle). This animal would roam widely around the map, with a tendency to loop around. You'd get the exact same behaviour if you multiplied all the values by 100 or a thousand (e.g. [4000, 1000, 0, 0, 0, 0, 0, 1000]). If you want to explore individual animal behaviours, you can disable starvation and reproduction in the console:
REPRODUCTIONENERGY = Infinity // Disable reproduction
ANIMALS[0].energy = Infinity // Disable starvation
ANIMALS[0].genes = [3, 2, 0, 0, 0, 0, 0, 1]; // Set the behaviour you're interested in.
Note: The first animal gets a huge artificial starting "energy", which means it will reproduce a bunch of times without having to find food, so it might be interesting to mess with it. You could kickstart the pessimistic breed by refreshing the page and copying this into the console: ANIMALS[0].genes = [0, 0, 0, 1, 1, 10, 1, 1] or hand craft something you think might do very well or very poorly (you'll need to refresh the page if they die out, but I've never seen that happen).
You can also watch the optimistic/explorer species evolve by tracking the forwards gene: _.maxBy(ANIMALS, 'genes.0').genes. I've added optimism or pessimism functions for this purpose too: _.maxBy(ANIMALS, optimism).genes