How to program a simple multi-agent predator-prey simulation in Python using Pygame

Chris the Multi-Agent Guy
Agents and Robots

--

Typical predator-prey systems feature various animals that compete for resources.

This article demonstrates how to program a simple multi-agent predator-prey simulation in Python. While we program a simple system, this example covers spacial multi-agent simulations, object-oriented Python programming, the Pygame package, biological population dynamics, and differential equations.

Nothing here is new — the author and many others already created such simulations 20 years ago. What has changed is the speed of computers and the domination of Python in (data) science. It is now possible to build such simulations with just a few lines of code and integrate the whole Python ecosystem. You can create a simulation system like the one in this video in less than one hour.

Some Background Information

Biological Predator-Prey Systems have been analyzed for a long time. Applicable mathematical models were developed independently by Alfred J. Lotka in 1920 and by Vito Volterra in 1926. The…

--

--

Chris the Multi-Agent Guy
Agents and Robots

Join me on my journey as a Software Engineer, Artist, and Geek, exploring the fascinating worlds of multi-agent simulations and machine learning. Follow me.