Imagining worlds of triangles

Experiments on simulating natural systems and evolutionary computing.

See the Pen ZOMBIE TRIANGLES INVASION (kind off) by Setup Draw (@SetupDraw) on CodePen.

In this first scenario there are a bunch of triangles wandering around the canvas but some of them are infected zombie triangles! If a zombie triangle gets close enough to a passer-by, it starts seeking his prey; at the same time the passer-by starts fleeing from the zombie. But zombies are fast, damn fast! If you really like zombies, you can zombify a random passer-by just pressing your mouse. In the end, anyway, all zombies will come back normal… and everything will start over and over again.

See the Pen Evolving Creatures by Setup Draw (@SetupDraw) on CodePen.

In this second scenario there are red carnivore predators triangles, white herbivore triangles and green squares plants.
Preys need to eat plants to live and escape form predators. Predators hunt preys for food and tends to avoid plants as they are “allergic” to them. The longer they survive the more likely preys are to reproduce. The more preys predators capture, the more new predators will come to join the hunt in this world. When a prey dies, a new plant grows somewhere. Press mouse to add new preys; press spacebar to add new predators.

Both simulations are based on “The Nature of Code” book by Daniel Shiffman, and made using P5Js framework.

Leave a comment

Your email address will not be published. Required fields are marked *