Wireworld 1K
Wireworld 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:
- Empty (dark cells): nothing happens on this cell. This is an insulator.
- Wire (gold): provides a means for electrons to travel upon.
- Electron head (blue): The forward-facing part of an electron.
- Electron tail (white): The backward-facing part of an electron.
Time moves in discreet steps, and the rules that govern cell states are:
- Empty cells stay empty
- Electron heads become tails
- Electron tails become Wire
- 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:
- The top circuit shows how a signal can be split into two copies.
- The middle and lower wires show components known as diodes - they limit the flow of a signal to one direction only
- The lower diode allows the incoming signal through, while the middle diode prevents the signal from passing.
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:
- Roll the Dice, in two steps: picks two random numbers A and B
- Computation: Runs the simulation until it reaches the answers
- Outcome: Displays the sum of A and B
The binary adder is composed of these inputs and outputs:
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.
To read a number, simply sum the bits where an electron is present:
# See Also
- https://en.wikipedia.org/wiki/Wireworld
Comments
Log in with itch.io to leave a comment.
an unsigned 7-bit number would be 127(0111 1111), not 126( 0111 1110).
Indeed it is! Well spotted.
To support numbers >126, and thus inputs over 63, I would have to add a new bit to inputs register, the 26 bit.
Makes sense. I really enjoyed it I think it was very well put together. I hope you expand on it in the future. Maybe add the 64th bit, or maybe Two's complement?