3 ms·
Early in my software development career, I tried building something like this. It's a really interesting problem, highly recommend trying it yourself. Even wi
by cwkoss 5y ago
Early in my software development career, I tried building something like this. It's a really interesting problem, highly recommend trying it yourself. Even with a simple system and very modest skills: it was able to create results that surprised me, which was very rewarding. Copying previously written comment (you might also be interested in the "ALiEn – a GPU-accelerated artificial life simulation program" topic of the thread or other similar projects in the comments)
https://news.ycombinator.com/item?id=27476768 https://news.ycombinator.com/item?id=27476768
---
When I was learning to program, I tried to make a toy artificial life evolution simulation. Particle organisms on a 2D plane had 'dna' which was a list of heritable traits, like size, speed, number of offspring. Bigger organisms could eat smaller organisms, but they burn energy faster. 0 energy = death. When two organisms of opposite gender collided and had sufficient energy, they'd give some of their energy split among the offspring, with each offspring's 'dna' values set to one of the parent's +/- 5%.
As I was developing this, I hadn't figured out how I wanted to do food yet, so as an easy first step, I just had a constant amount of energy that was split amongst all organisms on the screen. Lots of little dots buzzing around, was kind of neat but nothing too special. I left it to run overnight.
When I came back I was very surprised: previously i was running at about 30FPS - now it was running at about 4 seconds per frame. The screen was filled with dense expanding circles of tiny slow organisms emanating from where organisms had mated and nothing else.
My simulation evolved to outsmart my simple food algorithm: when food is divided equally among all organisms, the best strategy is to use minimal energy and maximize offspring count. I had populated the world with a default offspring count of ~5 and they had evolved to the tens of thousands. The more offspring an organism had, the greater the amount of the energy pool would go to their offspring.
It was a very cool "Life, uh, finds a way" moment - that such a simple toy simulation of evolution was able to find an unanticipated optimal solution to the environment I created overnight was very humbling and gave me a lot of respect for the power of evolution.
- IIAOPSW 5y agoPsst. Hey everyone. God's asleep. Let's have like 10,000 kids.