Brains

Agent Brains are the core of the simulation, and the agents. Every agent has a brain and the same number of neurons (Boxes), but they can have variable numbers of connections, and the way in which each agent connects them all is totally different from agent to agent. How this brain is laid out makes a great impact in the agent's behavior.

The agents process the inputs via the CPBrain (Connection Positive), which is based off the old Damped, Recurrent, Additive, Weighted, Sigmoid-processed (DRAWS) Brain.

Each box acts as a holder, taking the sum of the values from its possible inputs, adding a Bias, multiplying a Global Weight, passing it through a Sigmoid function, and finally applying a damping (Kp) factor before applying the result as the box's output for any future connections coming from it. In the case of the boxes in the Output range at the end, the values are used directly to set the Outputs.

If the box is not an output (tinted green), or has no connections that lead to an output, then the box is considered "Dead" and is indicated by a red "X". These boxes may eventually be mutated into usefulness, but are otherwise not useful and thus are not processed.


Each connection points from one box to another, has a Weight, and a connection Type (either Simple or Change-sensitive).


For Simple connection types, the value of the other box is taken, multiplied by the connection weight, then added to each other.


If a connection type is Change-sensitive, instead it subtracts the old value of the other box from the new value and multiplies it by 100. Then this value is multiplied by weight and added to the others.


(before version 0.07, there was a third type called Memory Lock, where if the target box value times the connection weight is higher than 0.5, then the whole box that's being calculated freezes. It does not update its value at all while at least one of these connection's conditions is true. This type was removed when we no longer had a fixed number of connections per brain box)


The sum input is then multiplied by the box's "global weight", calculated through a Sigmoid, then set as the box's target.


A dampening factor can delay the actual out value from achieving the target immediately.


This is done once for every agent, every box, every tick. It is the most resource-intensive portion of the sim, but it is also the most important.


*For initial spawns, only brain boxes before a given box can be referenced, or itself, but mutations can change this in later generations.