Skip to Main Skip to Footer Navigation

Elementary Cellular Automaton

About

This is my implementation of the Elementary Cellular Automaton using Wolfram codes. It was created in rust using the Bevy game engine and was compiled to Web Assembly.

Rule 28 creates a Sierpiński triangle.
With simple rules, such as rule 28 shown above, fractals can appear. This is an example of the Sierpiński triangle.

What is the Elementary Cellular Automaton?

The Elementary Cellular Automaton is a 1-dimensional cellular automaton. There is a 2-dimensional grid for visualization purposes where each cell can be alive or dead. Each cell follows the same rule, checking the cell directly above it as well as that cell's neighbors. Each row is a "generation" and the rows are spread vertically to visualize each generation.

The Rules

Although Rule 30 may be simple, it creates a complex figure.
An example of a rule. A black square represents a dead cell and a white square a living cell.

The rule is determined by the Wolfram code given, with rules ranging from 0 to 255. Each rule can be represented in binary as a string of eight zeros or ones. Each one or zero indicates whether a cell will be alive or dead, given a certain condition. In rule 30 for example, if three cells are alive, then the new cell will be dead. These simple rules can create complex patterns.

Although Rule 30 may be simple, it creates a complex figure.
Above is Rule 30 with 1025 cells in each row. The rule is known for showing complex behaviors can exist given a simple rule.

My Version

My version allows you to view each rule with a starting row consisting of a single alive cell or a random first row.

Rule 28 with a random first row.
Rule 28 with a random first row.

The controls for interaction if you are on a computer are as follows:

  • W: move view up
  • S: move view down
  • A: move view left
  • D: move view right
  • Q: zoom in
  • E: zoom out
  • Left Mouse Button: increase rule by 1
  • Right Mouse Button: decrease rule by 1
  • Middle Mouse Button: toggle random first row
  • Mouse Scroll: change rule (non-web version only)

For mobile, you can only tap to increase the rule.

Demonstration

Below is a version of the Elementary Cellular Automaton, compiled to be viewed on the web. You can interact with it by first clicking or tapping the Automaton, and then using the controls listed above. It is a 65x65 grid of cells.

Note: It may take a moment for the demonstration to load.

You can view the source code on my GitHub.

View on GitHub