<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1005154772848053&amp;ev=PageView&amp;noscript=1">

Surprisingly Educational Games: Boxcars

Alex Clatworthy

Sep 18, 2015

In science, you learn about some of the wonders of the universe. Plate tectonics, evolution, and relativity are all really cool, but many of them are hard to visualise.

Evolution is especially fascinating. We can see the products of evolution all around us, but what does it look like? How awesome would it be to watch?  To help answer that, let’s have a look at Boxcars.

What is Boxcars?

It looks a little confusing at first, but just watch it go. What’s happening is that the program is (by default) randomly creating 20 “cars”, made out of geometric spokes, and between 0 and 3 wheels. Most of them will break, or will be unable to move due to a lack of useful wheels. Those that can move head as far as they can along the track.


whateven.png

What is even happening here?
 

Once all 20 are done, the game picks the two which made it furthest to the right, and “breeds” another 18 cars. These cars are made from the 18 previous failures, mixed in with some components from the champions, as well as some random mutations.

The two champions and the 18 modified cars go again, and the process repeats indefinitely.

How does this relate to evolution?

What’s happening here is a pretty good analogy for evolution. Each car has “DNA”, which is a simple string that explains how the cars are built, the angle of the shock absorbers and the size of the wheels. Each section of the DNA could be considered to be a gene, encoding a single bit of information. The gene sequence for “only one wheel” is unlikely to be selected for, whereas a car with the gene for “three wheels” may make the car more competitive, and make that car more likely to be a champion.


bad.png

This sort of works, but it won't get too far.


The best thing about this kind of visualisation is that it lets you see some of the more subtle aspects of evolution. As I watch my cars, they are being “born” sideways, with the nose facing down. As soon as the car lands, it instantly flips onto its wheels and rolls away easily. Why does the car spawn nose downwards? Doesn't it know how silly it looks?

The reason is that a champion many generations ago spawned in such a manner, and it proved very competitive in spite of this. Other cars who got bits of the champion’s DNA received the genes to spawn nose downwards. It doesn’t hurt the car, and once it is the dominant mechanism, it’s very hard for the cars to change, as cars who spawn at a slightly different angle simply flip onto their back.

We see things like this in animal evolution, the human throat being one example: it’s not a perfect system (how often do you half-choke on food?) but any small change is likely to make it worse, and therefore make the offspring less competitive.

The evolving car experiment

Now my cars are spawning with an extra bit of body that ensures that the car has the right mass to land on its wheels when it spawns, but quickly breaks off. This isn’t unexpected - many creatures have small things that let them survive birth and adolescence, but quickly become unnecessary once the organism reaches maturity. An umbilical cord allows a fetus to receive oxygen-rich blood while in utero, but once born it can be discarded without any harm to the baby.

Some cars have wheels on top of them that don’t do much. The wheels get smaller with time, however. Many generations ago, the cars were less stable, and the wheel on the top would help it keep going if the car flipped onto its back. Cars in later generations didn’t need the wheel on top, but since it doesn’t make the car any less competitive and came in handy on rare occasion, it never went away.

Humans have plenty of things that don’t do a whole lot and occasionally just cause trouble (like the tonsils), but unless there’s a compelling reason for the part to be selected against, it’s likely to stick around.


good.png

Far from perfect, but it will do.

So stick with it for 10 minutes (or more), and try changing up the parameters. What happens if you set the mutation rate very high, or to 0? Do the cars work better sooner if you set the max wheels to two, and the wheel frequency to 100%? Does limiting the range of gene expression in this way make the cars better in the long term? Experiment a little, and watch the strangeness and power that evolution imparts to living things.

 
Interested in science? If you ever need help understanding a concept, connect with one of our expert online Science Specialists who are here to help in all science subjects. 
 
Get online study help now

About Studiosity

Studiosity is personalised study help... anywhere!

Did you know us as 'YourTutor'? Even though we have a new name, it's the same awesome service, same us.