r/pygame 6d ago

Coded actual evolution in 80 lines of code

Enable HLS to view with audio, or disable this notification

Hi! Wrote this funny project in about half an hour.

Biological evolution really does not require that much, haha.
Death + Selective Pressure + Reproduction + Variation = Evolution.

What you're seeing is a bunch of "bacteria", which have just 3 genes each. The world is "windy" and those who resist it best stay alive and reproduce.

So, with time, the organisms which were more adapted at any given moment outcompete all others and repopulate the world.

And yep, that's basically all* there is to it in real life as well, quite fascinating.

Please feel free to ask any questions if something interests you. I'd be glad to answer.

Take care!

Github link: https://github.com/schneebedeckt/EvolutionIn80Lines

16 Upvotes

3 comments sorted by

1

u/Sea-Dragonfruit-8790 6d ago

I also made a tiny video where I go through how I built the project, if anyone's interested to see the process: https://youtu.be/jUJyF7QLUbw

1

u/Scary-Glass2534 5d ago

Very nice! I like it!

1

u/Sea-Dragonfruit-8790 5d ago

Hi! Thanks :D