Skip to content
Android app to display cellular automaton
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
psds
res
src/net/nologin/meep/ca
.gitignore
AndroidManifest.xml
LICENSE
README.md
project.properties

README.md

WolframCA

What Is WolframCA?

This is an android app which displays the successive 'generations' of a one-dimensional cellular automaton (CA). This was inspired by chapter 6 of Allen B. Downey's excellent book, 'Think Complexity', where he describes the set of CAs as presented by Steven Wolfram in a set of early 1980s papers.

Further Reading

Installation

Version 1.4 of the app is available in the Play Store, and supports devices running Android 2.3.3 (API Level: 10, GINGERBREAD_MR1) or later.

The Display

Apart from a menu bar at the top, the application dedicates most of the area to the CA's output. Below is an example of Rule 90 (click for bigger):

click for bigger

The above screenshot was taken at a 'zoom' of 6 pixels per cell on a Samsung Galaxy Tab 8.9". The number of pixels per cell can be chosen (see below), and the view supports screen rotation.

Regardless of which rule number is chosen, we start the first generation as empty (all cells off), except for a single cell in the center of the topmost 'cell row' on the visible display. Here's a closer look at the view above for the first 15 steps (generations) of rule 90:

click for bigger

Menus/Options

The ActionBar across the top shows the currently selected rule, and offers dialogs such as:

  • Change Rule - Select one of the 256 rules using a seekbar, with prev/next buttons for finer selection of adjacent rules (click for bigger).

    click for bigger

  • Change Zoom - Change the number of pixels in the side length of each square 'cell'. Note that smaller cells will result in more generations being calculated during scrolling; This amount of calculation + bitmap generation is quite taxing on some older, or single core devices (click for bigger).

    click for bigger

  • Back to Top - Move the view right back up to the first generation of the CA.

  • Settings - Secondary options, such as debug (a feature of the TiledBitmapView , shows the tile grid along with info on variables), an 'About' dialog, and links to this project page.

The Code

IDE Setup

To build this application, the following dependency libraries are needed:

This project contains no IDE specific files. Pointing the 'import project' wizard of your favourite IDE (i.e. Android Studio / Intellij IDEA) at the root of this repository should be sufficient. If prompted, select Android 4.x to compile, but keep Android 2.3.3/API 10 as the minimum SDK. Add the libraries mentioned above as dependencies, and the project should compile and deploy.

Getting started with the code

In order to understand how the tiles are fetched and displayed, you should take a look at the README of the TiledBitmapView library.

All the classes are well commented, so the main/settings activity classes should be self explanatory. The more subject-matter related classes are:

  • WolframTileProvider
    • This implementation of the TileProvider interface is where the majority of the interesting code is. The generation data of the currently selected rule is calculated and stored here, and the code for rendering this data into tiles for display is also in this class.
  • WolframRuleTable
    • The code for calculating the next generation's state for a specific rule/cell.
  • WolframCAView
    • Subclass of the library's TiledBitmapView class, encapsulates code to let the main activity interact with our provider implementation.

Licensing

This app is licensed under the Apache 2.0 License, but also uses material that is copyright © 2002 Stephen Wolfram, LLC. The author acknowledges that such material is used with limited permission from and disclaims all affiliation with Stephen Wolfram, LLC.

See the LICENSE file for the full license details.

To Do

Except for fixing bugs that I might discover, this was just a fun learning exercise for me; I don't have any further features planned at the moment. However, if you have a feature request or feedback (or find any bugs!), please get in touch.

You can’t perform that action at this time.