Cellular Automata


Cellular Automata (CA) is pretty cool, and by following some very simple rules, it can produce some really interesting looking results. I created two programs to simulate a CA. One is the rule generator, which tells the CA how to determine the next generation. The rule generator persists the rules to a text file which the actual CA program will use to run the simulation. The CA is created using XNA, C# and my own Griddy2D libraries. A user can create an initial configuration file used the Tiled Map Editor. Griddy will import the .tmx file produced by Tiled and create the initial state of the world. Alternatively the simulation can generate a random start configuration.

  What is Cellular Automata?

Cellular Automata is a fairly simple concept. The simulation consists of a grid, each cell in the grid has a number of states. The states can represent anything, but in this simulation cells have two states, alive and dead. If a cell is alive it is given the color purple, a dead cell is colored black. The simulation requires an initial configuration, this configuration specifies the state of each cell in the world. The CA updates itself by applying rules to determine the state of the cells in the next generation. The rules return the new state of the cell by taking into account the state of the current cell, and the state of it’s neighbors. For example a rule may specify that if a cell is alive and every cell surrounding it is alive, then that cell should die. The rules are applied to each cell at the same time and they all change to their next state simultaneously.

  Creating the Rules

In order for the CA to do anything interesting, it must have a set of rules. To create these rules, I made a standalone program which will allow the user to generate rules. The program will persist those rules to a text file which the CA simulation can import.

Program used to generate the rules

The program which generates the rules

The boxes which are “checked” are blue. A checked box means that the state should be alive, unchecked means dead. The rule generated in this screenshot says that if a given cell is currently alive and its northern and western neighbor are alive too, then the next state of that cell should be alive. The user can create as many rules as they want, and the program will automatically override any duplicate rules.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s