Today I discovered that *Langton’s Ant* is not the only Turing machine that’s nicknamed after an animal. There’s also the *Busy Beaver,* invented by Tibor Radó. Despite its chaotic behaviour and unpredictable^{*} outcome, the machine itself is extremely simple and can easily be simulated on a TFT display by an Arduino.

[*video shows the final 3 steps of the busiest of all 4-state, 2-color beavers*]

The beaver’s workflow is: *read cell color -> lookup instructions for current [cell color/system state] combination -> adjust state -> adjust cell color -> move head -> start again, unless state equals X*.

In general, the components of a Turing machine, as described by Alan Turing in 1936, are:

- an infinite
**tape**, divided into an infinite number of cells, each of which can contain a symbol from a finite set of characters, including a ‘blank’ (the**alfabet**) - a
**head**that can read and optionally change the content of a cell, as well as optionally move to the next or previous cell on tape - a finite set of
*n*possible**states**that the system can be in, plus at least one additional state that marks the end of the process - a finite set of
**instructions**that, based on the current state and the currently read symbol, decides about: (**1**)*whether the symbol will be erased, overwritten or left as is*; (**2**)*whether the head will move one cell (left or right), or keeps it position over the tape*; (**3**)*what the next system state will beome*.

The alfabet in my sketch consists of **0** (‘blank’, white cell) and **1** (blue cell). The four system states are represented by **A**, **B**, **C** and **D**. Note that this 4-state machine has a 5^{th} state **X**, the *exit* state. A beaver must have exactly one (1) exit state. Also, all of its instructions must include movement of the head.

The algorithm could (in theory) simulate any 4-state, 2-color Turing machine on a 480×320 TFT diplay, but my sketch is initialized for simulating the ‘busiest’ of all possible 25,600,000,000^{**} *4-state Busy Beavers*: the one that stops with the maximum numbers of ‘**1**‘s on tape (13, after 107 steps). Luckily, it will not run out of Arduino’s limited virtual tape during the process (‘real’ Turing machines have an infinite tape, that’s why they can only exist as mathematical models).

It would have been impossible to simulate the busiest * 5-state* beaver, since several super computers and my Arduino 😉 are still searching for it. So far, ‘we’ have found one that has 4098 ‘

**1**‘s on tape when it stops.

^{*} *Turing proved that no single algorithm can exist, that’s capable of predicting the outcome of all possible beavers. Apart from the trivial ones, you’ll simply have to run them…
*

^{**}*In a Busy Beaver Turing machine, the head will always be moved. That reduces the number of possible [color, state, move] instruction triplets for a 4-state, 2-color beaver to 2x5x2 = 20 (remember the 5th X state). We have to provide instruction triplets to 4×2 = 8 state/color combinations (state X doesn’t need one), so there are 20^{8} different 4-state, 2-color Busy Beavers.*