## Adding 6 and 4 has never been so complicated.

In the video below, Matt Parker and his team set up over 10,000 dominoes to act as a circuit and perform simple mathematical calculations during the Manchester Science Festival. To understand how their domino circuits work, you need to know a few things about how computers perform operations.

### Binary

First of all, computers use a different number system than most of us do: binary. We use decimal numbers. For example, let’s look at the number 10: the digit furthest to the right represents 1s; the second digit represents 10s and so on. Thus, 10 is 0x1+1x10. In binary, the right-most digit still represents 1s, but the digits move up in powers of 2: 1,2,4,8,16… Let’s look at how the number 12 is built in binary and decimal:

Digit | 8s | 4s | 2s | 1s | | 1000s | 100s | 10s | 1s |

Number | 1 | 1 | 0 | 0 | | 0 | 0 | 1 | 2 |

Calculation | 1x8 | 1x4 | 0x2 | 0x1 | | 0x1000 | 0x100 | 1x10 | 2x1 |

| 8 | +4 | +0 | +0 | | 0 | +0 | +10 | +2 |

On the right we have the breakdown of 12 in decimal notation and on the left we have it in binary. 1100 in binary is the same as 12 in decimal.

### Addition

Because the only two values you ever see in binary numbers are 0 and 1, addition is much simpler. You add each digit one at a time with two or three inputs. Therefore, in binary:

Input 1 | Input2 | Input3 |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 carry 1 |

There is no such thing as a “2” in binary (2 is written as 10). When you start adding the second digit, the table gains a few rows because it has to account for an input that may have been carried from the previous addition:

Input 1 | Input 2 | Input 3 (Result from previous carry) | Result |

0 | 0 | 0 | 0 |

0 | 0 | 1 | 1 |

1 | 0 | 0 | 1 |

1 | 0 | 1 | 0 carry 1 |

0 | 1 | 0 | 1 |

0 | 1 | 1 | 0 carry 1 |

1 | 1 | 0 | 0 carry 1 |

1 | 1 | 1 | 1 carry 1 |

Let’s think about adding 4 and 6 as they do in the video:

1 | 0 | 0 | |

+ | 1 | 1 | 0 |

_______________________________________

1 | 0 | 1 | 0 |

All of the mini additions necessary for this calculation can be done using the simple table.

### Choices

Throughout the video, the dominoes have to “make choices” to perform their calculations. They look at each mini addition at a time and decide what the value of the final digits should be. As above, for the 1s digit, there are 2 inputs, so the builders used what they call a half-adder — a portion of the circuit — and for the rest of the digits there are 3 inputs so they use full adders — bigger repeating portions of the circuit.

These choices are made using what computer scientists call logical gates. In the case of a computer, the inputs are made using on-off electrical signals. In the domino circuit, they are made with falling dominoes. These gates are then combined to make the adders.

The two types of gates explained in the giant circuit video were XOR gates and AND gates.

An XOR gate lets the signal through if one and only one of the inputs in “on.” An AND gate lets the signal through only if both inputs are “on.” Let’s look at the piece of circuit below and consider the 4 options.

If neither pile A nor B is knocked over, nothing happens.

If pile B is knocked over but pile A is not, the dominoes fall over until they reach point E, and the chain of falling dominoes ends.

If pile A is knocked over but pile B is not, pile A sends dominoes falling in both directions. When those travelling to the right reach point C, they topple forward and prevent those that started left from making it through. Thus dominoes at point D are left standing, and the signal does not make it through.

If both piles are knocked over at the same time, those from pile B prevent the A dominoes from going right and the left-hand signal makes it all the way to the end unstopped.

This was an example of an AND gate since both piles had to be knocked over for the signal to make it out the other end.

Watch the video to see how Parker and his team make an XOR gate or try it yourself. His tips: make sure the dominoes sit completely flat, mark difficult positions with chalk so that you know exactly where to set the dominoes and, if you knock over a portion of the circuit while you are building it, let someone else re-build it so that you don’t get too frustrated.

In his words: “We’ve managed to show with this proof of concept that yes you can, you can actually build an entire computer out of dominoes, although we’ve also managed to demonstrate that you probably don’t want to.” It’s very time consuming to have to set all of the dominoes up every time you want to perform a new calculation, after all.

You may also like: Can a Computer Be Creative?

**UPDATE:* The article previously stated that dominoes "from pile B prevent the A dominoes from going **left **and the **right**-hand signal makes it all the way to the end unstopped."

We updated the article to correct this statement, as it should read, "from going **right **and the **left**-hand signal makes it all the way to the end unstopped."