Prisoner's Genetically Modified Life Sentence Dilemma

This model combines three ideas that have piqued my curiosity over the years:

The (Iterated) Prisoner's Dilemma
Genetic Algorithms / Genetic Programming
Cellular Automata

These are combined as follows: Each prisoner is represented by a cell in an array of cells (should we call this a prison?) and each prisoner has a probability of defecting in the next iteration of the cellular automata. This probability is considered to be the (very simple) genetic information carried by the prisoner. At the next iteration, the mean score that each prisoner would expect to acquire if they played an infinite series of prisoner's dilemma rounds with all of its neighbours is calculated (determined by the probability of defection of both the prisoner and each of its neighbours). After this, if a neighbour's mean score is larger than the prisoner's, the prisoner takes the probability of defection of the neighbour (mutated a little to maintain diversity). Thus, 'good' probabilities are propagated through the prisoners. Note however, that with certain (interesting) choices of values in the payoff matrix, a 'good' probability is determined by what the cell's neighbours are doing.

In the simulation below, purple (or orange) means that a prisoner is collaborating with its fellow reprobates (probability of defection is 0) whereas blue (or red) means that there is no honour among thieves (probability of defection is 1). Colours between the two extremes indicate that the criminal in question sometimes collaborates and sometimes defects.

One of the things I find interesting in this model is that collaboration can spontaneously break out in a region of defection. How pleasant.

Here we go then:

Click on the prison to restart the simulation