Topics › Simulation

Simulating a demand curve

Recently, I've been watching the new microeconomics lectures at Khan Academy, which got me thinking about creating an economics simulation, something I've thought about many times. Specifically, I was wondering about how to come up with a reasonable demand curve. They always seem to be drawn as a straight line but with no justification other than simplicity.

Sugarscape with Canvas

Below is an implementation of the Sugarscape simulation I made using the HTML canvas. It shows a 50x50 grid with each square containing between 0 and 4 units of sugar represented with different intensities of green. There is an initial population of 200 agents (red circles) which move about and eat the sugar.

Pygame particle simulation in 3D

Below is a video of my first attempt to move my Pygame particle simulation into the third dimension (thus combining it with my Pygame 3D tutorial). I meant to write about it a while ago, but got distracted trying to work out how to display an image rotated in three dimension (for the walls). I still haven't worked it out.

Sex in Sugarscape

Since the last time I wrote about Sugarscape, I've made a bit of progress. The biggest improvement is the introduction of sexual reproduction. I can therefore recapitulate more of the results of the original simulation, and test a number evolutionary ideas.

Horse race gambling simulation

I listened to the radio this morning and the host was talking about the Grand National, which is today.

Sugarscape revisited

Screenshot of my Sugarscape simulation

I can't believe it's over a year since I last wrote about creating a Sugarscape simulation in Python and Pygame. The page attracted a fair number of views, but I suspect several visitors were looking for the teen magazine. However, at least some of the visitors were genuinely interested and a couple of weeks ago I was contacted by someone interested in recreating Sugarscape in Python.

Hyphae simulation

I've started work on a simulation of fungus-like hyphae, based on project I saw called Mycelium.


Environment Simulation

A simulation of an environment and weather system in which cells might live.

Game of Life in one line of Python

This is my attempt at writing Conway's Game of Life in a single line of Python (an additional line is required to define the initial array, which is empty in my example, making the code even more pointless):

Adding ribosomes to my cell simulation

This is a description of some work I did on an older version of my cell simulation.

So far, the main adaptation that cells in my simulations have evolved has been an increase in of gene copy number. Such adaptations are unsurprising given that it's the only way cells can alter the relative amounts of each protein. In my final simulation I want to allow cells to alter gene expression using transcription factors to control rates of transcription (and thus translation).