A pseudo-code listing of the top-level algorithm is shown in Figure 4.6. Most of it should be self-explanatory. The Inoculate routine constructs a number of self-replicating programs and places them at specified positions on the grid (governed by the parameters ancestor, number and placement). The stopping criteria for the main loop may be to run for a given number of time slices (if the parameter limited_run is set to yes) or to run indefinitely (only stopping if and when all programs on the grid have died out). DistributeEnergyTokens places a number of energy tokens in each grid position, as described in Section 4.5.2. AttenuateMessageIntensities refers to the intensities of any EnvironmentalInfoStrings that currently exist in the environment. PerformOrganismLevelOperations checks, for each organism, whether a fission has occurred by the death of one of more cells within it (see under ``Fission'' in Section 4.3.9), subtracts energy tokens for each cell in a multicellular organism depending on how many neighbours the cell has (see under ``The Cost of Multicellularity'' in Section 4.3.9), and finally calculates and performs any movement of the organism from the contributions made by individual cells (Section 4.5.4). CheckOvercrowding checks whether the current population of cells on the grid exceeds the limit specified by the global parameter max_cells_per_process. If so, a fraction of the population (specified by the parameter population_cutback_on_overcrowding) is killed off. The choice of which cells to kill in this situation is stochastic, but is based upon how much energy each cell has stored in its Energy Token Store. BroadcastEnvironmentalInfo generates an environmental message of each grid position, as described in Section 4.5.6. AttenuateEnvironmentalEnergy removes a number of energy tokens from each grid position, as described in Section 4.5.2.