Of artificial life, evolution, and day and night

# Of artificial life, evolution, and day and night

In a previous post, I said that adding energy to the system would speed it up. Between that and adjusting the mutation rate, I was right. The figures are adapting to changes within minutes, instead of taking hours.

In the most recent post, I managed to get the figures to push a button when they see a light. Take a look at a typical run, after turning off the energy requirements and mutation, running the population that was produced, guesser0.pop.

good 304,606
looks 460,482
guess on 310,710
guess off0
plays 310,710
Realm size=30
population=11
Longest=100,001
most 0
Mutations 0
Figure births 99,991
extinctions 0
Elapsed time=0 hours, 2 minutes and 20 seconds

I realized that the bad calls could be an artifact of how I coded the problem. It’s a game. A round lasts between 10 and 50 cycles, chosen at random. At the start of each round, a coin is flipped to randomly decide if the light will be on or off during that round. Now and again, the figures look, see the light, and push the button, but, between the time that they look and when they hit the button, it turns off. If a human was trying to hit a button as many times as possible while the light is on, they’d likely make the same sort of mistake.

To test the population, I changed it so that the light is always on.

interrupting cycles
cycles interrupted
good 13,256
looks 13,257
guess on 13,256
guess off 0
plays 13,256
Realm size=30
population=0
Longest=16
most 0
Mutations 0
Figure births 6
extinctions 1
Elapsed time=0 hours, 0 minutes and 0 seconds

Okay, they didn’t get any wrong, but… they all died. Apparently, they need darkness to survive.

Look what happens if I set it so that the light is always off.

good 0
looks 199,983
guess on 0
guess off 0
plays 0
Realm size=30
population=11
Longest=100,001
most 0
Mutations 0
Figure births 99,991
extinctions 0
Elapsed time=0 hours, 2 minutes and 47 seconds

That confirms that they never deliberately hit the light-is-on button while the light is off. What’s more, if I reactivate energy and mutation, if the light is always off, the population will quickly go extinct. As often happens, they’ve both adapted to, and become reliant on, the environment from which they came.

I wanted to see if I could give them a game they could learn to play with no mistakes. I decided to make day and night. Each round lasts for 1000 cycles, always. At the beginning of the round, if the light was on, it’s turned off, if the light was already off, it’s turned on. Here’s the output when guesser0 is tested with day and night.

good 2,468,948
looks 2,623,866
guess on 2,473,994
guess off 0
plays 2,473,994
Realm size=30
population=11
Longest=100,001
most 0
Mutations 0
Figure births 99,991
extinctions 0
Elapsed time=0 hours, 2 minutes and 33 seconds

As you can see, guesser0 is making mistakes. So, guesser0 becomes the new seed population. The system was set so that pushing the button at the wrong time took away lots of energy. It will also turn on a rather high mutation rate. Pushing the button at the right time turns off mutation, and provides a smaller amount of energy. Take a look at a test run of guesser1.pop, the new population that was produced in less than five minutes.

good 729,905
looks 829,890
guess on 729,908
guess off 0
plays 729,908
Realm size=30
population=20
Longest=100,001
most 0
Mutations 0
Figure births 99,982
extinctions 0
Elapsed time=0 hours, 2 minutes and 14 seconds

This is what usually happens. The figures make a few mistakes at the very beginning, but that’s it for the rest of the run. If I turn off the energy system, guesser1 doesn’t do any better than guesser0.

When I saved guesser1, the game wasn’t saved. They get reloaded and day has suddenly turned into night. They’re off from the new day night cycle, until after they make a couple of mistakes and adjust. It’s the equivalent of jetlag.

I’ve been down on my figures as a very miserably bad AI engine. However, a little playing with the parameters, and a good answer is produced rather quickly. It will be interesting to see how well they do with more complicated problems.

OH HEY!

Just now, I decided to try something. The game usually defaults to starting with night. I changed it to start with day and…

good 729,870
looks 829,852
guess on 729,870
guess off 0
plays 729,870
Realm size=30
population=20
Longest=100,001
most 0
Mutations 0
Figure births 99,982
extinctions 0
Elapsed time=0 hours, 2 minutes and 13 seconds

Look at that!

I was going to settle for just a few errors at the start. All I had to do was make it start with day instead of night, and the jetlag was cured.