Cellular Automata models in Java

This page contains links to several cellular automata Java applets. They are still very unpolished prototypes, but available to play around with. Feedback is welcome. The source code is not being widely released yet. I plan to clean up the code when I have time, and then release it. If you really want it before then, please contact me.

To see the applets, you need a Java-compatible browser, with a relatively recent version of Java (if things don't work properly, try checking to see if there is a newer version of Java than what you currently have installed). And of course Java support has to be turned on. See below for more information on Java and web browsers.

The Applets

You may want to skip down to the brief introduction to cellular automata, or more information about the controls in the applets before you actually run them.

Here are the applets so far (hopefully more will be added later):

Brief introduction to cellular automata

You can think of a cellular automaton model as a piece of graph paper, with many small squares, called cells. Each cell can have one of several colors. Or instead of colors, you could use numbers to describe the value in each cell (the values are called "states").

The squares are updated as follows. A clock ticks regularly, and on every tick of the clock (every "time step"), each cell examines its own value, and the values of some of its neighbors. It uses those values, and follows a kind of recipe or rule, which describes what its new state will be after the clock-tick. Every cell does this simultaneously, using its own value and the values of some of its neighbors, to compute their new value. They then all change their state to their new values, all at once.

It sounds somewhat abstract. But cellular automata models have been used for many things, from simple attractive "screen savers", to studying the theory of computation, to modeling phenomena in physics, ecology/biology, geology, and fluid flow.

The Controls

Note, you should left-click on buttons such as "Start" or "Stop", and right-click to pop up menus such as "Array Operations", etc.

  • From the "Array operations" menu, you can either choose "Clear" to set all cells to state 0, or "Random" to set each cell to a random state (all states having equal probability).
  • Press the "Single Step" button to run a single time step.
  • Press the "Start" button to run continuously. (The button then turns into a "Stop" button, which you can press to stop running.)
  • You can select the running speed, from among Slow, Fast, and Fastest.
  • The "Time step" label indicates how many time steps have been run (the counter is reset by certain operations).
  • You can use the mouse to "draw" in the array in order to change the states of cells. The "Drawing state" item lets you specify which value the mouse will draw into the cells.
  • The Drawing Brush Size lets you draw more than one cell at a time; you can draw an NxN box of cells (the mouse is at the upper-left corner of the "paint brush").

In addition, some rules have their own special controls, e.g. which let you change the number of states, or vary the neighborhood used, etc. See the individual applets' web pages for more information.

Java

Pretty much all major web browsers currently have support for Java, although you may have to jump through some hoops to get it installed, depending on your platform.

If you don't have Java installed, you can download it from java.sun.com. The simplest thing to download in order to run these applets is the Java Runtime Environment (JRE) for the Java 2 Platform, Standard Edition (J2SE). At the time of this writing, the current version is J2SE 1.4.2 which you can download from here. You don't need the Software Development Kit (SDK) unless you will be programming Java yourself.

Mac OS-X

I've recently started using some machines running OS-X, and have found that when these applets are run within Firefox, the image updates very infrequently (i.e. not every frame is displayed), even though the simulation itself runs along steadily. Running the applets in Safari gives much smoother updates, i.e. the image is refreshed regularly. I have no idea why this happens; if you do, and better yet know how to fix the problem, please let me know.

Literature

Some books discussing cellular automata are:

No, I don't work for MIT Press or receive any kickbacks from them...

Acknowledgements

I developed this software with support from a Learning Circles Grant (with co-PI's Larry Latour, Raymond O'Connor, Jim Wilson, and Liying Yan) from the UMaine Center for Teaching Excellence, and a Faculty Technology stipend from the UMaine Department of Information Technologies.

I was inspired to write these in part by a couple of workshops/courses on complex adaptive systems I co-taught with the above colleagues and with Huijie Xue, and by the students in my various classes who wanted to play with my simulations which until that point would only run under Linux since I'd written them in C using X11 for the graphics.

My first versions of these applets were based on a Game of Life Java applet by Edwin Martin.