User:PkmnQ/WireWorld

From Esolang
Jump to navigation Jump to search

WireWorld is a cellular automaton first implemented by Brian Silverman in 1987 as one of the predefined rules for Phantom Fish Tank, a cellular automaton simulation program.

Description

An example WireWorld circuit.
An example WireWorld circuit.

WireWorld operates on a 2D square grid of cells, each of which can be in one of four states (background, electron head, electron tail, and wire). In one time step, all of the cells' states update simultaneously according to the following rules:

  • A cell in the background state unconditionally stays in the background state.
  • A cell in the electron head state unconditionally changes to the electron tail state.
  • A cell in the electron tail state unconditionally changes to the wire state.
  • A cell in the wire state conditionally changes to the electron head state if exactly one or two neighboring cells are in the electron head state. Otherwise, it stays in the wire state. (Neighbors are counted using the Moore neighborhood, i.e. the eight orthogonally and diagonally adjacent cells.)

These rules end up producing the behavior of electrons moving through wires, which can be used to perform logic.

Examples

Diode

It's possible to create a diode component that allows electrons through from one direction, but not from the other.

Demonstration of a diode in WireWorld.

Logic gates

It is also possible to create logic gates:

See also