This is a simple evolution simulation that I made. Press space to start the simulation by spawning a yellow, the basic creature. Once in a while, the yellow will produce offspring, meaning more yellows, and after living for a while, it will die. However, when a yellow reproduces, the offspring has a chance to mutate. The yellow will either mutate into a cyan or a green. Cyans live for longer and greens reproduce faster. What do you think will happen? Note: If your first yellows died out before they had a chance to make a sizable population (there's really no way they can die out after they have enough creatures), just press space again to spawn another one.
This was sort of inspired by some of the videos by https://www.youtube.com/channel/UCKzJFdi57J53Vr_BkTfN3uQ , it's a great channel that's both interesting and educational, go check it out! For the people that want to know how the details of the simulation, I'll explain here (pressing "See Inside" to check out the raw code is also a good idea). PART ONE: LIFESPAN AND OVERCROWDING Every second, a yellow or green has a 1 in 10 chance of dying of old age, cyans have a 1 in 30 chance. Also, yellows and greens wait their population size divided by 80 seconds to die of overcrowding, and cyans wait their population size divided by 180 seconds. PART TWO: REPRODUCTION Every 1 to 3 seconds, a yellow or cyan reproduces, greens reproduce every second. When a yellow reproduces, the offspring has a 1 in 15 chance to be a cyan or green.