| domum | utilis | studium | esoterica | nexum
Wolfram Automata (QB64)
William F. Barnes



Copyright © 2014-2025 by William F. Barnes. All rights reserved. Unauthorized retention, duplication, distribution, or modification is not permitted. [Legal]

Download

Abstract

Recreating the first cellular automata discovered by Stephen Wolfram, including the famed Rule 30.

1) Introduction

The Cellular Automata

After hearing about the Wolfram Physics Project sometime in 2020, an old memory from high school sprang to my attention. In certain brick-and-mortar bookstores, when they were still around, I was unable to resist picking up a book called A New Kind of Science (written by Stephen Wolfram) every time I'd spotted it. Browsing through this heavy tome without doing any actual reading, it was glaringly obvious that Wolfram's "new science" looks nothing like the "old science". The book is filled with images of Aztek-esque glyphs, labarynthian pyramids, fractal triangle mosacis - all rendered on a rectangular grid in black and white. Wolfram adopted the term cellular automata to describe how the images are made.



My first impression of the so-called "new science" was "this looks like Atari graphics, what's the big deal?". As an amateur programmer, I remarked something like "this stuff isn't that much different from what goes on when creating screensavers and frivilous graphics demonstrations back at home". Indeed, certain images in the book were all-too-familiar from my own meddlings with plotting fractals, random walks, mosaics, and so on. But is that really science? If so, something about this was going over my head. I never actually purchased the book to resolve this issue for myself, as my book-buying budget was repeatedly flatlined by University bookstores. Zooming a few decades downstream of its publication, A New Kind of Science is now free to read online at Wolfram Science.

The Hypergraph

In 2020, Wolfram announced the launch of a new endeavor that seeks to discover the "set of rules" governing our universe, which is to say he is looking for a unified theory of physics. Taking a glance at how this is being attempted, it's clear that the "new science" of 2002 has been highly generalized by Wolfram (and surely others) into a "new-new science". This paradigm assumes nothing concrete at all - everything about a system is represented by nodes on a hypergraph with certain rules governing the local dynamics between nodes. The notions of space, time, mass, energy, and so on - are not axiomatic in this model. Instead, each of these must be somehow distilled from the details of the underlying hypergraph - but I digress.



Our Mission Today

In this study we will retrace Wolfram's early path by re-creating the original cellular automata in a QB64 program. The source code is available as one file (see above). All figures (of automata) in this study were generated using outputs of the above.

2) Problem Setup

A) Anatomy of a Cellular Automata

The anatomy of a cellular automata consists of (i) an initial state, (ii) a set of rules, and (iii) the evolved state(s). The initial state is a one-dimensional string of bits, plotted horizontally by tradition. As the automata evolves, the updated state is printed directly below the previous state.



The rule for updating the automata isn't always obvious by inspection of the resulting image. This particular example being shown is called Rule 45, represented by eight T-shaped blocks as shown. (Much more on this in a moment.)



B) Setting Initial Conditions

The initial state is allowed to be any configuration of "on" or "off" bits, denoted as black and white squares, where the total number of bits can be arbitrary. Conventionally, the initial state is set to have one single black square in the middle, with white squares extending out "infinitely" to the left and right. As with many simulations, care should be taken to specify what happens at the boundary of the workspace, but we can proceed without worrying about this for now.



Apart from the "standard" initial state depicted above, any initial state is allowed, such as repeating patterns:







...or even a random initial state:



C) Listing All Rule Inputs (8)

The rules for updating a given state to the evolved state are somewhat like functions, ingesting input and producing output. To produce the nth new bit in the evolved state, Wolfram decided that the answer shall be determined by the previous value of n, along with its two nearest neighbors. That is, each "function" takes three inputs and delivers one output.

A given input will have three squares that are colored in any combination of black or white. Counting all possible inputs, it follows that there are 2^3 = 8 in total. Looking again at the rubrick for Rule 45, we see these eight rules listed across the top row:



Expressed in a black-and-white binary number system, the eight rules are visually analogous to the numbers 0-7, listed backward.

D) Listing All Rule Outputs (256)

To be continued...