Readit News logoReadit News
pjs_ · 2 years ago
I wrote the original version of this nearly 20 years ago. Cool to see it still pop up here from time to time.

Still runs in the browser thanks to Ruffle:

https://peteshadbolt.co.uk/posts/ga/

cpeterso · 2 years ago
I worked on Adobe’s Flash Player team at that time and I remember using your Flash movie as a test case. :)
pjs_ · 2 years ago
Wow, thank you for sharing this. Means a lot
CasperH2O · 2 years ago
Do you have some examples of results when running this for a few days?

Or perhaps, 20 years? ;-)

nickpsecurity · 2 years ago
Or another civilization wrote it a few, billion years ago. We might see the results fly by our planet this week.
b800h · 2 years ago
On Firefox here, the "Save Local Population" option seems to crash. Any idea why that might be happening? (Amazing site btw - every time it pops up I end up spending much too long with it).
cpeterso · 2 years ago
Where do you see the "Save Local Population" option? When you say it "seems to crash", do you mean Firefox or the Flash animation?
s1k3s · 2 years ago
What would be the consequences of adding a hitbox on the structure (or springs?) as well, as opposed to having it only on the load?
fywsu · 2 years ago
As internet distractions go, the original was one of the most memorable I ever came across. A friend and I used to leave them running over lunch and see who was winning when we got back. Thanks for the fun :-)
zamadatix · 2 years ago
I remember running this in the background any time I was in the computer lab at school. Thanks for making this back in the day :).

There were a few genetic algorithm "polygons approximate picture" pages back in that era as well.

mywittyname · 2 years ago
Thanks for writing this all those years ago. It made for a fun demonstration when I was learning genetic algos in college.

Deleted Comment

ryandrake · 2 years ago
It seems to always get into a rut where one design lucks out and dominates generation after generation, with no mutations producing anything even close to working. Like, the top ten don't change after hundreds of generations. Maybe this is just an attribute of genetic algorithms. They quickly zero in on something kind of good, and then get stuck at this local maxima. Or maybe I need to just play around with the Mutation Rate and Mutation Size settings.
thfuran · 2 years ago
>Maybe this is just an attribute of genetic algorithms

It happened to crocodiles and it could happen to you too.

sinuhe69 · 2 years ago
In general, one should keep the mutation rate really low to allow the population slowly change over time. High mutation rate will lead to local optima quickly but also very hard to get out. Low mutation rate will require significant more generations but in general result in better adaptation.
klyrs · 2 years ago
Sounds like you're running with a single elite clone. That's a really bad idea in genetic heuristics for exactly the phenomenon you mention.
hhmc · 2 years ago
Is the correct number 0 or >1?
taneq · 2 years ago
If you keep going long enough they'll probably turn into crabs.
3D30497420 · 2 years ago
It seems like more should change than just the shape. I'd wager that a slower car with more power may be less likely to get stuck in ruts. But it seems that the power and speed don't vary, just (barely, after a few generations) the shape.

Edit, I scrolled down and it covers the genome:

• Shape (8 genes, 1 per vertex)

• Wheel size (2 genes, 1 per wheel)

• Wheel position (2 genes, 1 per wheel)

• Wheel density (2 genes, 1 per wheel) darker wheels mean denser wheels

• Chassis density (1 gene) darker body means denser chassis

It basically lands on a two-wheeled medium-bodied shape and doesn't seem to make much progress after that. Power and speed would be interesting variations.

sevensor · 2 years ago
What happens in an evolutionary algorithm depends on what you write it for. This is a fun toy, but what it does specifically is explore a very limited simulation of evolution by natural selection. Metaheuristics aimed at optimization have a lot of techniques aimed at not stalling out on a prematurely converged design, as well as improving other desirable properties of the population, at the expense of any pretense of fidelity to real-world evolution processes.
Applejinx · 2 years ago
This is why I said it needed crossover and got downvoted into oblivion :) turns out it at least tries to have crossover, so maybe the genome doesn't translate to crossover doing anything relevant.

I wasn't fooling. Think about it for a second, if your process involves a lot of crossover that means large sections of working genome will be passed on. If the ONLY mechanism for changing anything is mutation, then mostly you're just breaking what works.

That's what you're describing, so I'd look at how the genome is constructed to understand why it's not doing more.

iamgopal · 2 years ago
More improvement needs wild environment changes.
jmole · 2 years ago
this is fun, even though the speed controls aren't super intuitive. You can press "Surprise" to speed things up and go through a bunch of iterations quickly.

The mutation rate (likelihood that g changes) and mutation size (Δg) are fun hyperparameters to tweak while watching the population evolve over time.

It would be interesting to see a gene for "compliance" so the cars could have some kind of suspension. EVerything more or less evolved into a sort of tron-bike shape for most of the runs I tried.

canjobear · 2 years ago
> EVerything more or less evolved into a sort of tron-bike shape for most of the runs I tried.

I ran it in the background for a very high mutation rate for a long time and it managed to come up with something very different---a little wheel attached to a big wheel, which bounces around and goes over all the obstacles.

gus_massa · 2 years ago
Old discussions:

https://news.ycombinator.com/item?id=5942757 (664 points | Jun 2013 | 169 comments)

https://news.ycombinator.com/item?id=10600486 (162 points | Nov 2015 | 57 comments)

gavinsyancey · 2 years ago
So boxcar2d, but without flash.

https://news.ycombinator.com/item?id=2196747

KennyBlanken · 2 years ago
...and apparently all the suspension parameters stripped out for some bizarre reason.

The physics simulation clearly uses inelastic collisions, which is wildly unrealistic and why so many otherwise passable 'cars' don't pass the course. Also seems to use a very low coefficient of friction - most of my cars couldn't make it up a two-segement slope.

gavinsyancey · 2 years ago
... Apparently boxcar2d works perfectly in Ruffle, which the Internet Archive automatically loads :)

https://web.archive.org/web/20240428203838/http://boxcar2d.c...

robotnikman · 2 years ago
I knew I had seen something like this over a decade ago!
gield · 2 years ago
This html5 version has also been around for longer than a decade already. It's what inspired me to take a class on Genetic Algorithms and Evolutionary Computing in university back then.
khqc · 2 years ago
Slight bug: there's no road past about 280m, all cars fall into an endless pit
VyseofArcadia · 2 years ago
The Great Filter
ketralnis · 2 years ago
Time comes for us all
harshaxnim · 2 years ago
Just wait a little longer for the flying cars.
dustfinger · 2 years ago
> evolve random two-wheeled shapes into cars over generations

Where I come from, we call two-wheeled automobiles motorbikes. Very cool simulation though!

dotancohen · 2 years ago
The simulation that these cars are driving in has no third dimension for the vehicle to fall over into (or where to put another pair of wheels). So, like a traditional four-wheeled car, these vehicles do not tip over at 0 velocity. I think that property is enough to qualify their behaviour as more similar to four-wheeled cars than motorbikes.
trekhleb · 2 years ago
It is a very visual and entertaining visualization, I love it.

It inspired me to experiment with a genetic algorithm in "Self-parking car evolution":

https://trekhleb.dev/self-parking-car-evolution/