Their first task was easy
Their first task was easy. Can the digital organisms I wrote, called “figures,” learn to call a good command and avoid a bad one?
My first job was easy. It only took 6 lines of code. Each digital creature, each “figure,” has a certain amount of energy.
Figure.energy = 12,168;
Each time a figure has a turn, (when they execute one command,) the energy level drops.
Energy=energy-1;
When a figure is out of energy, it dies. It is completely deleted from the system, leaving behind it’s children, if it had any.
If (figure.energy <= 0) Death.kill(figure) [scary music!] End if
That part was simple to code, the rest of this took just a bit more work, but not really all that much.
I’m working with our old friend 6.pop. There are six figures in that population. When one of them dies a new figure is born. I didn’t code that; six does that all on her own. In addition to having a steady population size, 6.pop survives an average of 50 mutations before going extinct, pretty good for such a small population. In fact, I’ve thrown all sorts of things at them, and these figures often survive where no others can.
(Brad pat’s 6.pop on the head.)
Also, she’s magic! Despite days and days of computer time, I’ve never been able to get another population like her. 6.pop is apparently an extremely low probability event that I happened to luck in to.
To get a population to do the one thing and avoid the other, they’ll get energy when they do the one, and lose energy when they do the other. Simple, but how much energy should they get? For that matter, how much energy should they get at the beginning. If they don’t have any at all when they first start they’ll all just die. Too much, and nothing will change.
If the figures in 6.pop start with an energy level of 12,168, all is well. The population stays steady, and a steady stream of new figures are born, copy themselves, and die, all very circle of life. If the energy level is just one less, 12,167, the population drops to 5. At half, 6084, only three figures are left.
To call a command, a figure does a port call. It sends a message to a given address. To show that their behavior changes when energy levels are changed by what they do, we start by just opening up the ports and counting how often each one is called. There is no adding or subtracting energy yet.
You’ll notice that mutation is on. If there are no mutations, neither the good or bad port gets called, and 6.pop never goes extinct. Basically, no mutation and nothing changes.
good 2,265,728
bad 10,218,794
Longest=23,825
Mutations 2562
Cycles 701,148,274
Turns 3,878,296,378
extinctions 100
Elapsed time=0 hours, 4 minutes and 12 seconds
As you can see from the output, the bad port is getting called more often than the good one. That’s been consistent across multiple runs. For some reason, if there are no consequences, 6.pop likes the bad one.
This time, if the good port is called, the energy level is increased by 6084. If the bad port gets called, the energy level is decreased by 6084.
good 68,513
bad 145
Longest=40,731
Mutations 3477
Cycles 993,184,761
Turns 5,253,162,883
extinctions 100
Elapsed time=0 hours, 5 minutes and 51 seconds
So there it is. Simply because populations that call the good port will survive longer than those that call the bad one, the good port gets called much more often. But, even if one of the populations learn to only call the good one and never the bad one, it still eventually went extinct. To be able to save a population that has figured it out, they’ll need to be protected from mutation.
This time, if a figure calls the good port, it gets 6084 added to it’s energy, and it, its parent figure, and its child figure will no longer be mutated. If the bad port is called, 6084 units of energy are lost, and if the figure and its family were protected from mutation, they aren’t anymore. Since one of these populations will end up immortal, the run will stop if a population manages to make 100,000 babies. The most babies produced by any population is kept track of in “longest..” Thus far, the most babies born to a population has been just under 41,000. Right, and here we go!
good 196,789
bad 108
Longest=100,001
Mutations 96
Cycles 230,933,789
Turns 1,168,928,154
extinctions 2
Elapsed time=0 hours, 1 minutes and 6 seconds
Wow, that was quick. It usually takes more extinctions than 2. Now we can save this population. Then, for the next run, we load it into memory and see what happens.
good 199,996
bad 0
Longest=100,001
Mutations 0
Cycles 204,893,854
Turns 1,024,209,281
extinctions 0
Elapsed time=0 hours, 0 minutes and 59 seconds
I didn’t turn off mutation. By calling the good port early and often, this new version of 6.pop did that all by herself.