ACML - Automates Cellulaires en caML

ACML is an implementation in an obscure language of a naive solution to one of the most common programming exercise: simulating cellular automata.

In a few words:

Usage & Examples

Basic usage: launch and watch

Launching ACML without any command-line option give you an interface with many buttons. Try to click on buttons. See what happens.

Screenshot Screenshot

More interactive usage

Try this:
acml cyclic
In this example, you can explore the family of cyclic cellular automata by adjusting parameters in the user interface.

Examples

To have an idea of what ACML can do, you can try these command lines (try one line at once):
acml --nogtk --run life
acml --nogtk --run bosco
acml --nogtk --run 54
acml --nogtk --run sandpile
acml -vx 200 -vy 500 -x 100 -y 250 --nogtk --run fire
acml --nogtk --run B3678/S34678
acml --nogtk --run --refresh_rate 100 langton
acml --nogtk --run majority --- neighborhood Moore states 5 radius 4

A small program's worth a thousand clicks

The primary goal of ACML is to allow quick writing and testing of new automata rules. To achieve this the key features are:
  1. rules as programs: to define a transition rule you have the full expressive power of a high-level programming language (OCaml). For instance, the transition rule of Brian's Brain cellular automaton can be written like this:
    let transition_rule cell howmany = match cell with
    | Excited -> Refractory
    | Quiescent when howmany Excited = 2 -> Excited
    | _ -> Quiescent
  2. automtic compilation/dynlink process: you write the source in OCaml, click Open... (right toolbar) in the user interface, select your file and ACML do the rest.
  3. parameters: instead of a single rule, your source code can describe a whole family of rules depending on some parameters. Then, without changing the source code, you can adjust the parameters from the user interface and easily test all the rules in the family.
  4. everything is programmable: you are not only free to write new automata rules, but also new initial configurations, new ways to display the universe, new ways to measure quantities along time, new ways to interact with the mouse, etc. Moreover, all this comes with a simple plugin system which allows to factorize code.
  5. reproducibility: ACML can manage random seeds for you. If you use pseudo-randomness apropriately in your source files, you can generate and simulates as many rules on as many configurations as you want and just click Save when you're happy: a new source file is saved and opening it will reproduce exactly your last experiment.

Documentation

Some help on how you can write your own cellular automata:

Download

5 reasons NOT TO download the binary version

  1. your OS is not Linux
  2. architecture/library dependencies problems
  3. some features (load/save ACML source files) require an OCaml compiler on your system in the exactly same version as the one used to generate the binary
  4. source archive is a lighter download
  5. who knows, I might become root on your machine...

Compilation

Prerequisites

WANRING! OcamlSDL version 0.9.0 (and maybe also some earlier versions) contains a bug in mouse click detection. OcamlSDL version 0.9.1 works.

ACML should compile on any plateform where you can install these prerequisite (tested on Ubuntu Linux and Mac OSX).

Debian-based linux distributions

On Debian-based linux distributions (tested with several Ubuntu distributions), you should get all what you need with this single command-line:
sudo apt-get install ocaml ocaml-findlib libsdl-ocaml-dev liblablgtk2-ocaml-dev libcairo-ocaml-dev libzip-ocaml-dev

Other systems

If your OS has some kind of packaging system, you may find corresponding package names starting from the list above. Alternatively, you can use GODI (source code OCaml distribution). The following list of GODI packages should be sufficient:
godi-ocaml-all godi-findlib godi-lablgtk2 godi-ocamlsdl godi-cairo godi-zip
To install these packages, external libraries (e.g. SDL, GTK+2 and CAIRO) must be installed on your system (they are not provided by GODI). This installation method works on MacOS (tested on 10.6 and 10.4, using fink for external libraries).

Compilation instructions

In the src/ directory of the decompressed archive, type:
make
sudo make install
In case of a compilation failure, it might be necessary to do run make clean before another make.

Customization

In the directory src/builtin, you can add or remove as much ACML source files as you want. Each file can contain a family of cellular automata or a plugin. During the compilation, all these families or plugins are embedded in the binary.

FAQ