Starting a Sugarscape simulation

[Updated here]

On a trip home, a while ago now, I came across a small collection of Tomorrow’s World magazines from 1998. Inside were several interesting articles and adverts. I was particularly interested by adverts for then cutting edge cameras and phones, which look so dated now. I also found an article that had fascinated me at the time, about a computer simulation of societies, called Sugarscape. The simulations where very simple (as successful simulations tend to be). It consisted of little more than a grid containing a resource (sugar) on which agents moved, collecting and eating the sugar. By introducing a few more rules, Sugarscapes' creators introduced trading, warfare, disease and a bit of evolution. The creators hoped (rather too optimistically as I thought even back then) to simulate ancient civilisations (the Anasazi, in particular), and maybe even our own.

I also read about Sugarscape in a book called Virtual Organisms, which received as the only prize I ever got at school and which contained a lot of inspiring science. After rereading the Tomorrow’s World magazine article, I had to reread the book. It contains several stories of scientific breakthroughs just about to happen around 1996 when the book was written. Sadly, many of them don’t appear to have broken through. For example, Prof. Hugo de Garis was on the verge of simulating a brain using a cellular automaton machine; apparently he is still trying, now in China. He’s written a fair bit about genetic algorithms it seems – apparently, quantum computing will make genetic computing redundant.


Back to Sugarscape, I was quite surprised to find that a (really quite ugly) Java version of the Sugarscape simulation is still available to play with and download at Either I didn’t have the access to the internet in 1998, or the simulation wasn't online then, but either way, couldn’t watch Sugarscape myself, much as I wanted to. However, the simplicity of the simulations inspired me to attempt to create my own versions in QBASIC. I can’t really remember the results, but I think I had a grid of food that followed the same rules as Conway’s Game of Life, which I’ve seen other similar simulations use and is interesting to watch in itself. I can’t remember if the agents made much difference, but I think it was quite interesting to watch the population grow and collapse.

After reading about Sugarscape again, I was re-inspired to simulate it, this time using Python. In less than a day, I came up with a reasonable basic simulation. In this new version, which I think is more similar to the real Sugarscape (I've since created an almost identical simulation), there is an underlying level of nutrients in each grid of the square. This determines the maximum amount of sugar (which is coloured green – the lighter the shade, the more sugar) that can exist in that square. During each unit of time, each square of sugar has a chance of growing and spreading to neighbouring squares.

Screen shot of my Sugarscape

The agents have a hunger level between zero and five. Each turn it increases by one and they can decrease it by eating a unit of sugar. They can carry some sugar and each turn they either gather sugar from the square they are in or move to a neighbouring square, based on a simple decision tree. Every few hundred units of time they can divide into two agents (like binary fission) if they have sufficient food. The agents are randomly coloured red and blue to represent two tribes or two genders, but at the moment, the colour makes no difference to anything. The colour does however, become dimmer the more hungry and agent is, leading to the sad sight of agents becoming dimmer and dimmer before disappearing when they starve to death. It’s quite hypnotic to watch the agents go about their lives as the population booms and busts.

The simulation is fairly basic and there are lots of ways I’d like to expand it, but even now it’s surprisingly easy to become emotionally involved following a single agent as it struggles to find food. As the population grows, the sugar levels become depleted in some areas (such as on the left side in the above picture), and agents move away or starve. The population continues to grow and move, leaving behind a trail of devastation. At some point, the agents will have nowhere left to run and the population will crash. The only hope is that one or two agents will survive in small isolated areas to rebuild the population.

I’m amazed how much time I have spent watching this simple little simulation when I should have been adding sex, disease, farming, fighting and various other factors. It could be a start to the societal simulation I considered making after reading Guns, Germs and Steel.

Post new comment

The content of this field is kept private and will not be shown publicly.