Wireworld 1K

stable

A binary adder cellular automaton.

wireworld.gif

My entry for the PICO-1K Jam Sep-Oct 2022. The goal was to make cool things in PICO-8 by using only 1K (1024) Compressed Bytes of code.

Wireworld 1K is a Turing-complete cellular automaton (CA) suited to simulating electrons moving on copper wire. By placing copper in specific configurations you can build electronic components - transistors, timers and logic gates.

This cart implements a Wireworld CA Binary Adder. Two numbers represented in binary (little-endian, LSB) are added together. The largest decimal value it can calculate is 126 (an unsigned 7-bit number).

Wireworld was first proposed by Brian Silverman in 1987.

Rules of Wireworld

Wireworld consists of a grid of cells, each can be in one of four states:

Time moves in discreet steps, and the rules that govern cell states are:

  1. Empty cells stay empty
  2. Electron heads become tails
  3. Electron tails become Wire
  4. Wire becomes an electron head if one or two of its neighbors are electron heads (Moore neighborhood)

The animation below demonstrates three electrons as they move along separate wires:

diodes.gif

Diodes are not used much within Wireworld since wires rarely carry bi-directional signals, but these demonstrate how the Rules can be used to build complex interactions. If you are interested to read more about Wireworld, check out the links below.

How To Play

This cart is an interactive rail demo, press any of the Pico keys (Z, X, or Arrow keys) to advance to the next step:

  1. Roll the Dice, in two steps: picks two random numbers A and B
  2. Computation: Runs the simulation until it reaches the answers
  3. Outcome: Displays the sum of A and B

The binary adder is composed of these inputs and outputs:

input_output.png

The Inputs and Output are serially encoded binary numbers. The order of the bytes, also known as Endianess, is least-significant byte first (LSB). That just means the smallest bit (1) is read first by the adder.

bit_labels.png

To read a number, simply sum the bits where an electron is present:

read_output.png

Cartridge

If you have the Pico-8 fantasy console you can load this cart:

wireworld.cart.png

See also


Journal

Date Title
11 Mar 2023 source code