💾 Archived View for uscoffings.net › writing › 20141031-evolution-2.md captured on 2024-06-16 at 12:33:16.

View Raw

More Information

⬅️ Previous capture (2022-06-03)

-=-=-=-=-=-=-

# Modeling Evolution (update)

[tags: evolution, modeling, software]
[date: 2014-10-31]

In my [previous post](../20141020-evolution), I started trying to model evolution, but I was stymied by "cancer", in which the child cells took all of their rightful genetic material and also stole the parent's.  Repeat this a few times, and you have exponential growth, and the simulation grinds to a halt.

I analyzed the mutations that caused this cancer.  (It may be useful to refer to my previous post.) This original sequence:

    JMP_HEAD
    NOP_C

mutated into this:

    JMP_HEAD
    NOP_A

which let all hell break loose.

The result is that the next `H_COPY` command chopped off the tail which marked where the copy was to end.  Therefore, the child's `IF_LABEL` would never terminate the copy loop.  The `H_COPY` might run forever, or another mutation could cause it to terminate.  But due to other details (you can walk through and figure it out, but with the missing tail, `H_SEARCH` would fail, and therefore `RH = WH = 0`) the `H_DIVIDE` command would give the entire 2x larger genome to the child.

How did I fix this?

- Hack which doesn't work: If the entire genome goes to the child, that's too traumatic on the parent.  Therefore, they both must die.  It was funny, because immediately after I put this hack in, the child evolved to leave a single instruction to the parent.  It survived, and still ran the machine into the ground.  I was stupid for expecting otherwise: I was asserting a selective pressure against stealing the entire genome.
- Organisms now have a random chance to spontaneously die.  The risk is higher for larger genomes.  Think of this as a nasty alpha particle hitting the genome and blowing it up.  This is a selective pressure against uselessly large genomes.  I do not love this idea, because time time and energy used to copy a large genome should itself be a selective pressure against large genomes.
- Adding energy:  There is now plant life, and organisms harvest energy from it.  Organisms with more energy can execute instructions faster.  Energy is not evenly distributed.  This is my first real selective pressure.
- Finally, there is a hard cap on genome size.  The child can be approximately the same size as the parent, but capped (currently) at 8k.  Until my selective pressures are sufficient, this prevents runaway growth.

With these changes, you have this:

![Evolution screenshot](evolution2.png)

The green is available energy (aka plant life).  Evolved organisms first ran right because they are, by default, "oriented" that direction.  With further evolution they can learn how to turn (note the colored "bubbles").  It is not yet clear that they are figuring out to move towards the food.  Perhaps in the next update.