In January 2013, I started working on an evolution simulator,
but I never finished it.
The simulator lay dormant for two and a half years.
Until now!
Just this week I have resurrected it, and it's time to see the (almost) finished product!
Since there are no creatures yet, create 1000 creatures.
They will be randomly created and also very simple.
Wait, before we get started, I should tell you what a creature *is*.
Every creature has an internal clock, like a heartbeat, except that it never changes speed throughout the creature's life.
This is a node.
Nodes can vary in friction, from white being very low friction, to black being very high friction.
Nodes collide with the ground, but they don't collide with each other.
Two nodes can be connected with a muscle.
Muscles have many more traits than nodes.
They have an extended length and a contracted length.
They also have an extended time and a contracted time.
which are based off of the internal clock.
Finally, muscles have strength.
Basically, a muscle is rarely exactly the length it's trying to be.
It's always trying to push or pull its two nodes
so that it reaches its target length.
How hard can it push or pull? That's its strength.
The higher a muscle's strength is, the more opaque it appears.
Okay, so who gets to determine all these traits, like how friction-y nodes are,
or what muscles' contract times are?
Well, at the beginning, it's just random chance:
They're randomly generated.
So, here are our 1000 randomly generated creatures.
Their goal is to run as far as possible to the right in 15 seconds.
They don't know that yet, but it's true.
To start off, let's do a step-by-step generation,
to see what's going on behind the scenes with every generation that happens.
Here is our first creature!
It's got just 15 seconds to prove how well it can move to the right.
But it's not doing very well.
It's just getting up and then collapsing, and then getting up and collapsing.
I mean, it is going right, which was the goal,
but it's not going very fast.
0.86 meters -- Can the next creature do any better?
Unfortunately, when all nodes hit the ground at the
same time, that's pretty much it for the creature,
because at that point, there's really nothing to
push or pull against, so the creature just can't move
anymore.
So this collapsed triangle gets a measly negative nine millimeters.
We're going to speed up the playback right now,
so we can get through all 1000 creatures in time.
Also, look how symmetrical this creature is!
But it still moved backward.
Our fourth creature has what looks like a sail
sticking up in front, but it's not catching any wind.
Because these creatures were randomly generated,
I think it's fair to say that about half will go left
and about half will go right.
That is, if you don't count the ones that don't move at all!
Oh, I forgot to mention that a creature's position
is determined by the average position of their nodes.
So a creature can't just fling one of its nodes really far forward
and get an unfair advantage that way.
Now we've seen 10% of the creatures.
But don't worry, it's going to speed up really fast from here.
All 1000 creatures have been tested.
You can see creature 1 in the upper left --
that's the one that kept collapsing and getting up again.
And here's the rest of the first four.
Well, anyway, let's sort them all, from fastest to slowest.
Going backward is considered very slow.
Here's our first creature. Despite all of its stumblings, it still managed
to rank 26th out of 1000 which puts it in the top 3%.
I guess it's not hard to do well, when your competition is all randomly generated!
Creature 195 managed to do the best out of all 1000, traveling almost 2 meters in just 15 seconds.
Just watching it, though, you can tell that improvements can be made.
Who was the slowest creature?
Well, that's creature #331, who traveled even further
than the fastest creature, but backwards.
Ok, let's kill the 500 slowest creatures. Boop!
To be specific, there's a slight gradient, allowing some lucky slow creatures to survive,
and some unlucky fast creatures to die.
But overall, the faster you are, the more likely you are to survive.
Hooray for creature 1, who, as expected, survived, and gets to pass on their genes!
Creature 2 and 3 died, though; they were too slow.
And creature 4, right around the middle, survived also.
As we reproduce, you can see how the gene pool slightly improved,
due to this killing of the slow and spreading of the fast.
Also, the new offspring are slightly mutated from their parents, again randomly.
Nodes might become more or less friction-y,
and muscles might gain or lose strength.
Less frequently, bigger changes will happen,
such as losing or gaining nodes or muscles entirely.
But those are rare, and again, are determined randomly.
Reproduction here is asexual, so there's no mixing of the genes.
I know that could be a major setback for the creatures.,
but I'm sure they'll still get by fine.