Skip to content

ghjansen/cas

Repository files navigation

CAS - Cellular Automata Simulator

Build Status Latest Quality Gate Status Maintainability Rating Lines of Code

The Cellular Automata Simulator (CAS) is a project of didactic and scientific purposes, based on the publications of Stephen Wolfram and other great authors like Andrew Ilachinski, Harold V. McIntosh, Joel L. Schiff; also inspired by the ideas of Stanislaw Ulam and John von Neumann. See the full reference on page 65 of the monograph.

The project assists in the study of cellular automata by providing a simple platform that allows for practical experience of the theoretical concepts.

Download

Download the latest release here. You can also check out all previous releases here.

Before using CAS, please consider reading this page from Wolfram Research to ensure the basic understanding of Elementary Cellular Automaton. The monograph is also available in brazilian portuguese here.

CAS is distributed under the GNU Affero General Public Licence v3.0 (AGPLv3) and is compatible with Mac, Linux and Windows.

Structure

CAS is currently organized in 5 modules: cas-core, cas-control, cas-unidimensional, cas-ui-desktop and cas-docs. The table below contains a summary of each one of the modules:

Module name Description
cas-core Abstract structures that represent the common characteristics of most cellular automata, independent of the amount of dimensions.
cas-control Abstract resources for controlling the simulation lifecycle.
cas-unidimensional One-dimensional implementation of the cas-core and cas-control modules, responsible for defining specific characteristics and controlling the simulation of one-dimensional cellular automata.
cas-docs Documentation.

Core overview

Originally conceived to simulate elementary cellular automaton, CAS was designed to allow for the implementation of most kinds of cellular automata, independent of the amount of cells, dimensions, iterations, rules, etc.

The data model in cas-core abstracts common characteristics of cellular automata, forming a fundamental structure to simulate any cellular automaton. The set diagram below shows the composition between the elements of the data model, suppressing cardinality.

The image below highlights some of the elements of the data model through a elementary cellular automaton by using the representation commonly found in literature. In the image below you can find Rule (A), Transition (B), Combination (C), State (D), Space (E) and Cell (F).

From all elements of the data model, Time, Space and CellularAutomaton are the most important. More information about each one of these elements is detailed below.

Time

The number of dimensions used by the cellular automaton affects not only the cellular Space but also Time. This feature is oriented to the sequential nature of the simulator, which updates the Space and Time in an atomic operation until the end of the simulation.

To allow for Time to operate in a dimensional way, two approaches were created: absolute time and relative time. The absolute time is responsible for maintaining the amount of Space iterations already processed by the CellularAutomaton and is represented by an integer. The relative time informs the next Cell to be processed within the current iteration and is represented by a list of integers, where the number of elements in the list is equal to the number of dimensions of the CellularAutomaton.

The Time class is a dynamic counter incremented from its lower limit (zero) acting on each of the dimensions (relative time) until it completely processes a Space iteration (absolute time), repeating this cycle until it reaches the limits of Time.

Time increases its counters during a simulation in a mathematical ratio equivalent to the product of the limits of the relative counters multiplied by the limit of the absolute counter, minus one. This formula is shown in the image below, where a represents the absolute counter,d represents the amount of relative counters (or amount of dimensions), ri represents a relative counter i and lim is the function that obtains the limit of each counter.

Space

The Space class is a dynamic array responsible for keeping all Cells from the initial condition defined for the simulation (initial attribute), the history of the iterations already processed (history attribute), the last iteration processed (last attribute) and the iteration that is being processed (current attribute). The initial, last and current attributes are lists of generic type in order to allow multidimensional structures, whereas the history attribute is a list of lists, since history stores copies of current. The image below shows a representation of the attributes initial (A), history (B), last (C) and current (D) through the computation of elementary rule 110.

CellularAutomaton

The CellularAutomaton class is the conceptual representation of the cellular automaton used in the simulation. The logic of this class uses other classes like Rule, Transition, Combination and State. The algorithm executed by the CellularAutomaton is:

The amount of times that the algorithm of the CellularAutomaton is executed can be represented by a mathematical ratio similar to Time increasement formula, except that for the CellularAutomaton algorithm execution formula there is no subtraction of 1, as shown by the image below.

Contribute

There is a lot to be improved and created. Check the list of issues and all projects to see what's happening, maybe including your suggestions or bugs found. If you feel inspired by one of the issues/projects or by CAS itself, feel free to make contact through .