# Binary addition

Let’s design a very simple computer. It will take two inputs and add them.

Here’s the computer (source):

The inputs are the two tubes at the the top of the tank.

The computer can only add 2 numbers and those numbers can be 0 or 1. If you want to add 0 and 0, then you do nothing. If you want to add 0 and 1 or 1 and 0, then you pour a bucket of water into one of the tubes at the top. If you want to add 1 and 1, then you pour a bucket of water into one of the tubes and you get a friend to pour a bucket of water into the other tube at the same time.

How do you read the output? Imagine that there’s a bucket catching water that flows out of the “XOR” outlet at the bottom of the tank. You look to see if the “AND” bucket in the middle of the tank has water and you look at the “XOR” bucket. If the “AND” bucket has water, then the answer for the computation is 2. If the “XOR” bucket has water then the answer is 1. If neither of the buckets have water, then the answer is 0. Remember to dump out the water from the buckets every time you want to do a new calculation.

(Note that you have to make the “AND” bucket big enough so that it doesn’t overflow. There should be water in the “AND” bucket or in the “XOR” bucket or in neither, but not in both. “XOR” stands for exclusive or).

For example, if we add 0 and 0, you do nothing. Then you look at the buckets. They have no water in them, so 0 + 0 = 0.

If we add 0 and 1, you pour a bucket of water into one of the tubes. Suppose the input tubes are very long, so once the water enters the tank it’s like a jet stream going pretty fast (you have to climb a very tall ladder to get to the top where you can pour in the water). The water goes into the tank on one side and hits the opposite side missing the “AND” bucket and flows into the “XOR” bucket that we’re imagining is catching the water at the bottom. Then, you look at the buckets. The “AND” bucket will be empty and the “XOR” bucket will be full, so 0 + 1 = 1.

If we add 1 and 1, then the two streams of water entering the tank will deflect each other and fill the “AND” bucket and none of the water will get to the bottom of the tank. We see that the “AND” bucket is full, so 1 + 1 = 2.