Turing Tumble Community

Turing Tumble Difference Engine

Here’s an approach for building Turing Tumble machines using read/write registers with a serial data bus. Each register stores a binary number and can support reading, writing, addition and other operations. Two parallel ball paths (0 and 1) are used as a serial bus for sending binary numbers between registers one bit at a time. Each register has 0 and 1 paths for both input and output. A simplified Babbage Difference Engine using some Digi-Comp II ideas is shown as an example.

This image shows a one-bit read/write adder with gear bits set to a 0 value. Instead of using ramps for read-only registers and bit parts for write-only registers it combines the features of both using gear bits. An input 0 ball goes through two gear bits on the left and reads the current value to the output 0 or 1 path without changing it. A 1 ball toggles the rightmost gear bit to add to the value and handle carry in and out.


The next image and simulator link show a two-bit read/write “accumulator” register containing two adders. Each accumulator has a “distributor” that routes input balls to each adder bit sequentially. Binary two-bit numbers are sent serially as two balls with each ball in either the 0 (left) or 1 (right) path. An all-zero input number will read the current value to the serial output 0 and 1 paths without changing it. Any 1 balls add to the accumulator and handle carry and overflow.

To run, use the 0 (blue) and 1 (red) levers to input two-bit binary numbers and observe the arithmetic operations. For example, entering a red and then a blue ball for binary “10” will add decimal 2. The output balls in this example go to interceptors but could go to another accumulator. For example, a “00” number could be routed through two of these accumulators stacked vertically to read the first one and add its value to the second.


The next image and simulator link show a simplified Difference Engine using three four-bit read/write accumulators. It evaluates quadratic polynomials using only addition. Using more stacked accumulators will calculate higher order polynomials without using any more balls. The number of bits per accumulator can be increased. To match Babbage’s precision would require eight 64-bit accumulators.

The accumulator three low bits represent values from 0 to 7 (binary 000 to 111). The high bit clears every second number to all zeros to read the accumulator below it and add to the one below that. These clear bits must be initialized to alternating directions for each accumulator which alternates between adding even numbered accumulators to odd numbered ones and vice versa. Each even/odd loop iteration repeats two operations: add the D1 accumulator value to the f(x) one, then add D2 to D1.


To calculate a polynomial function f(x) such as “x squared” make a difference table where each D1 and D2 entry is the difference of the two numbers to its left. Both decimal and binary values are shown in the table below for clarity. Enter the top row initial values 0, 1, 2 (binary 000, 001, 010) in the accumulators from bottom to top (already done for this example in the image and simulator link). Calculating initial values is more complicated for higher order polynomials using more accumulators.

To run, press the blue lever. Each full even/odd eight-ball iteration calculates the next row in the difference table with the f(x) results 0, 1, 4 (binary 000, 001, 100) in the f(x) accumulator until it overflows before reaching 9. The counter at the bottom pauses after each iteration to view the result (use the blue lever to continue).


Roughly speaking, I think it works.

Here is the equation to write down

D2(x) = D2(x-1) = 2 ; for blue ball only
D1(x) = D1(x-1) + D2(x-1) = 2x + 1
f(x) = f(x-1) + d1(x-1) = n^2

“clear” seems to be a carry move, but I couldn’t figure out the details.

I think the serial data bus was used to multiply in textbook.
There it couldn’t be changed because it was using ramps, but here it can be changed because it is using gears.

I have an idea to add a “read/write” bit on top of the distributor, which will launch either a blue or red ball to the next “write”, depending on the result of the “read”.
This would make it possible to add memory from a lower position to a higher position, or copy memory, etc.

Thanks for the comments.

Typically each table column is calculated by hand in this order to get the top row initial values:

f(x) = x^2
D1(x) = f(x+1) - f(x)
D2(x) = D1(x+1) - D1(x)

Then the machine computes each following row by:

f(x) = f(x) + D1(x)
D1(x) = D1(x) + D2(x)

The “clear” flip-flops reroute all 1 balls to 0s for every other number so the all-zero numbers read and add alternating even/odd pairs of registers. This simplified the design since the machine only adds a register to the one below it.

That’s a good idea to route 0/1 as blue/red balls from the bottom to the top of the board to allow adding to a higher register, It should work but would be complicated. I’ll post another example where that idea might be more applicable.

1 Like

Here’s an example of a Turing Tumble machine that changes its register data paths while running. This image and simulator link show a programmable calculator that repeats a user-programmed sequence of instructions, similar to very early computers. A larger version of this machine could be programmed to simulate a Difference Engine.


The two bus switches on the left side route each two-bit read/write accumulator register on or off the serial data bus. The switches route both the 0 and 1 paths either left or right when toggled by a ball. The vertical bus on the left side bypasses each accumulator while the diagonal bus on the right goes through it.


The four adjustable program ramps define a two-instruction loop that controls the bus switches. The number of instructions in the loop could be increased by making the program controller bigger. The ramp T/B means Top or Bottom bus switch toggle and the 1/2 indicates the first or second instruction in the loop. If a program ramp sends the ball left then the accumulator is toggled on/off the bus.

The program repeats a multi-step calculation using accumulators as variables. Each instruction can switch any two accumulators at a time on the bus so the first one is added to the second one. This example only has two accumulators but could have more and some registers could do other arithmetic or logical operations.

The mathematical capability is limited since the accumulators can only be added to lower accumulators. As Yama-chan noted above, adding to higher accumulators might be done by wrapping 0/1 bits as blue/red balls off the bottom of the board back to the top.


The “clock” at the top controls a four-ball cycle that sends two balls right to read program ramps and switch accumulators on or off the bus, then sends two 0 balls left to add one accumulator to another, similar to a CPU fetch-execute instruction cycle.

To run, press the blue lever to execute each instruction. The counter at the bottom pauses execution to view each result. The default program switches the accumulators on and off the serial bus and adds the top accumulator value 001 to the bottom one until it overflows.