Using loop to Evolve!

image with no caption

Let’s create another game, making full use of loop. But this won’t be a game that we play. Instead, it will be a game world that evolves as we watch it! We’re going to create an environment of steppes and jungles, filled with animals running around, foraging, eating, and reproducing. And after a few million units of time, we’ll see that they’ve evolved into different species!

Note

This example is adapted from A.K. Dewdney’s article “Simulated evolution: wherein bugs learn to hunt bacteria,” in the “Computer Recreations” column of Scientific American (May 1989: 138-141).

Our game world is extremely simple. It consists of a simple ...

Get Land of Lisp 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.