Lesson goal: Cellular Automatum

Previous: Normally distributed rnd nums | Home | Next: Birthday Surprise

Telling you what a Cellular Automatum (CA) is would take way to much room here. We'll at least try thought: In short, an automatum is a set of rules that operate on "cells," which in this case are pixels. The rules dictate how an initial configuration of cells (or pixels) are to "evolve" into future generations. CAs are known to evolve into sometime boring, but sometimes rather complex and unusual patterns, all from a single pixel.

In the case here, we'll turn on a single cell, or pixel, at position $(50,0)$. Then, we'll go down to $y=1$ (the next row) and see how it should appear, given the single pixel on the row above it at $(50,0)$. After the $y=1$ row is done, we'll go to $y=2$, and draw it, based on how the $y=1$ row came out. So an automatum is a massively recursive graphic. Each row depends on the row above it, all starting with a single pixel.

To determine if a pixel, say at $(x,y)$, should be turned on or off, we look to pixels in the previous row, at positions $(x-1,y-1)$, $(x,y-1)$, and $(x+1,y-1)$. CA "Rule 90," which is implemented here, says to turn on pixel $(x,y)$ if the three pixels in the row above it are either off-off-on, off-on-on, on-off-off, or on-on-off. If the three are in any other state, the pixel at $(x,y)$ is to be off.

We'll leave learning more about them to you. We really like this page the most. For now, here's an implementation of "Rule 90." Note the single pixel turned on at $(50,0)$ evolves into an interesting mix of nested triangles!

Now you try. Just hit run, but promise you'll teach yourself what Cellular Automata are!

Type your code here:

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.