CompSci 308
Fall 2018
Software Design and Implementation

Cell Society

The chess-board is the world; the pieces are the phenomena of the universe; the rules of the game are what we call the laws of Nature. — T. H. Huxley

Cellular Automata, CA, are simulations based on a model that consists of a regular grid of cells, each in one of a finite number of states (such as on and off). Simulations start with all cells in an initial state and are run by updating each cell based on a set of fixed rules described in terms of the cell's current state and the states of its immediate neighbors. Though this model is simply described, it can be used to simulate a wide variety of complex phenomena, such as ant foraging to economic theory to the whole universe! In fact, after 20 years of study, Stephen Wolfram declared CA were a universal mechanism for moving scientific study forward in his 1280 page book A New Kind of Science that contains hundreds of example models.

Nifty Assignments is a collection of successful programming projects assigned to CompSci students. Three of these projects, aimed at CompSci 101 or CompSci 201 level courses, may look very different but they are simply different examples of CA:

All of these are simulations based on a CA models of a real system, built to better understand it, to observe and predict its behavior, or to perform experiments on the model. Many real systems are difficult or impossible to observe and control, much less experiment with, because they involve events that are not precisely predictable though the relative frequencies of event results may be known, e.g., a flipped coin comes up heads roughly as often as tails, one can not be certain of a particular result. A simulation program, however, may be easily run repeatedly and modified to explore the effect of changes to the model.

Specification

In teams, write a Java program using JavaFX that animates any 2D grid CA simulation — at the very least, the three simulations described in the linked assignments. The cells are composed of their state and their rules for interacting with their neighbors. The grid can be of any size (chosen by the user) and a set of rules (e.g., whether a cell changes state, is created, or moves to another position in the grid). The simulation is run by applying the rules on each cell "simultaneously", i.e., based only on their current state, and then updating their states in a second pass.

Formally stated:

A CA is a manifold of computing cells which repeatedly update their internal states. The update process is characterized by parallelism, homogeneity, and locality. Parallelism means that all the cells are updated at the same time, in lock-step synchronization. Homogeneity says all cells use the same update rule; and locality says cells only gather information from their nearby neighbors. — Rudy Rucker, San Jose State University

The kind of simulation, its starting configuration, as well as any initial parameter settings are read from a data file formatted in the eXtensible Markup Language, XML. XML is an open, industry standard, flexible format, supported by both Microsoft and Apple as well as many web protocols and Linux programs, that is also supported in all modern programming languages, including Java. While it may be viewed as "overly-verbose", it is generally easy to read and generate algorithmically. The exact format of this configuration file is to be determined by your team.

Design Goals

This assignment provides a context to begin thinking about issues of design and coding style.
  1. Making your code flexible. You will build this project in several steps, but you will not know the exact details of the next steps beforehand. Thus, you should try to structure your code so that later parts can be easily added on (i.e., you will find out for yourself if the code you designed really was flexible).
  2. Developing a clean coding style. Your code should adhere to modern coding standards, like those followed by most professional coders. This encompasses everything from formatting your code consistently to structuring your code in small, single-purpose, functions.

Deliverables

In order to encourage you to think about code flexibility, this project will be released in stages.

Resources