5.6 KiB
Rule 110
Not to be confused with rule 34 xD
Rule 110 is a specific cellular automaton (similar to e.g. Game of Life) which shows a very interesting behavior -- it is one of the simplest Turing complete (computationally most powerful) systems with a balance of stable and chaotic behavior. In other words it is a system in which a very complex and interesting properties emerge from extremely simple rules. The name rule 110 comes from truth table that defines the automaton's behavior.
Rule 110 is one of 256 so called elementary cellular automata which are special kinds of cellular automata that are one dimensional (unlike the mentioned Game Of Life which is two dimensional), in which cells have 1 bit state (1 or 0) and each cell's next state is determined by its current state and the state of its two immediate neighboring cells (left and right). Most of the 256 possible elementary cellular automata are "boring" but rule 110 is special and interesting. Probably the most interesting thing is that rule 110 is Turing complete, i.e. it can in theory compute anything any other computer can, while basically having just 8 rules. 110 (along with its equivalents) is the only elementary automaton for which Turing completeness has been proven.
For rule 110 the following is a table determining the next value of a cell given its current value (center) and the values of its left and right neighbor.
left | center | right | center next |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 0 | 1 | 1 |
0 | 1 | 0 | 1 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 1 |
1 | 1 | 1 | 0 |
The rightmost column is where elementary cellular automata differ from each other -- here reading the column from top to bottom we get the binary number 01101110 which is 110 in decimal, hence we call the automaton rule 110. Some automata behave as "flipped" versions of rule 110, e.g. rule 137 (bit inversion of rule 110) and rule 124 (horizontal reflection of rule 110) -- these are in terms of properties equivalent to rule 110.
The following is an output of 32 steps of rule 110 from an initial tape with one cell set to 1. Horizontal dimension represents the tape, vertical dimension represents steps/time (from top to bottom).
#
##
###
# ##
#####
# ##
## ###
### # ##
# #######
### ##
# ## ###
##### # ##
# ## #####
## ### # ##
### # #### ###
# ##### ## # ##
### ## ########
# ## #### ##
##### # ## ###
# #### ### # ##
## # ### ## #####
### ## # ##### # ##
# ######## ## ## ###
### ## ###### # ##
# ## ### # #######
##### # #### # ##
# ## ### ## ## ###
## ### # ## ### ### # ##
### # ## ###### ### ## #####
# ######## ### ##### # ##
### ## # ### #### ###
# ## ### ### ## # ## # ##
The output was generated by the following C code.
#include <stdio.h>
#define RULE 110 // 01100111 in binary
#define TAPE_SIZE 64
#define STEPS 32
unsigned char tape[TAPE_SIZE];
int main(void)
{
// init the tape:
for (int i = 0; i < TAPE_SIZE; ++i)
tape[i] = i == 0;
// simulate:
for (int i = 0; i < STEPS; ++i)
{
for (int j = 0; j < TAPE_SIZE; ++j)
putchar(tape[j] ? '#' : ' ');
putchar('\n');
unsigned char state = // three cell state
(tape[1] << 2) |
(tape[0] << 1) |
tape[TAPE_SIZE - 1];
for (int j = 0; j < TAPE_SIZE; ++j)
{
tape[j] = (RULE >> state) & 0x01;
state = (tape[(j + 2) % TAPE_SIZE] << 2) | (state >> 1);
}
}
return 0;
}
Discovery of rule 110 is attributed to Stephen Wolfram who introduced elementary cellular automata in 1983 and conjectured Turing completeness of rule 110 in 1986 which was proven by Matthew Cook in 2004.