A More Lifelike Simulation
To make life in the terrarium more interesting, we will add to it the concepts of food
and reproduction. Each living thing in the terrarium gets a new property, energy
, which is reduced by performing actions and increased by eating things.
When it has enough energy, a thing can reproduce, generating a new creature of the same
kind. To keep things reasonably simple, the creatures in our terrarium reproduce asexually,
all by themselves.
If there are only bugs, wasting energy by moving around and eating each other, a terrarium will soon succumb to the forces of entropy, run out of energy, and become a lifeless wasteland. To prevent this from happening (too quickly, at least), we add lichen to the terrarium. Lichen do not ...
Get Eloquent JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.