Browse over 9,000 car reviews

20 July 2017

Ready to reach zero percent productivity? Meet Genetic Cars

By Tom WhiteTom White
I hope you didn't have anything important on today...

Elon Musk was right: The AI revolution is coming, but not as we imagine it. Rather than sudden nuclear apocalypse, the machines have started out by ruining office productivity.

I mean seriously, if you work in an office, it will stop operations entirely. Our office went into a coma for several hours yesterday.

Why? Possibly the coolest little bit of code you might ever use.

I give you: Genetic Cars

It's an 'intelligent' algorithm that generates two-dimensional two-wheel drive 'cars'. They run the course until something stops them, then they try again, adjusting a set of 'genetic' parameters, trying to get further each time. It's seriously addictive.

Laugh, cry, get frustrated with genetic dead-ends. Laugh, cry, get frustrated with genetic dead-ends.

The 'genes' control the chassis shape and weight as well as the wheel size. The longer the algorithm runs, the more it 'learns' about the randomly generated track. Better designs steam ahead, while horrific mutants usually become extinct.

KILL ME. KILL ME.

It's like a little physics-based automotive microcosm that shows Darwinism in live action. It's totally mesmerizing. The best part is, once it's started you don't actually need to do anything, it'll just run forever on its own (or until it crashes, which is heartbreaking... you get attached to your weird mutant 2WD vertex spawn as they evolve.) We left one overnight, and came back to it frozen, guess I'll never know how it scaled a 90-degree incline.

Sometimes the bizarre origami designs are the best. Sometimes the bizarre origami designs are the best.

You do get some minor variables to play with that adjust the algorithm's progress, you can change the gravity and the mutation rate (how often the algorthm experiments with wacky designs) and size (how far the algorithm is allowed to adjust each variable).

Graphs show the average distance reached by each generation, the top scores and the amount of track generated. Graphs show the average distance reached by each generation, the top scores and the amount of track generated.

No two simulations will ever be the same as there are many random variables, but you can share the randomly generated terrain to play 'competitively' with others.

Probably don't share it with any co-workers who actually need to do something though, it's completely addictive. You just want to see the little things succeed.

Is Genetic Cars not the coolest little bit of code on two wheels? Tell us what you think in the comments.