P.S. I think this book would be great reading related to the topic:
http://en.wikipedia.org/wiki/Code:_The_Hidden_Language_of_Computer_Hardware_and_SoftwareI'm going to build a computer from the ground up from an electronics standpoint, as most computers are actually made, and not from the viewpoint of Turing machines, which are
basic abstract symbol-manipulating devices which . . . are not intended as a practical computing technology, but a thought experiment about the limits of mechanical computation.
First off, we need to design some type of relay/trigger that can switch things on and off when a signal is applied. This can be done with water flowing onto a pressure plate and causing a floodgate to open or a gear assembly to activate.
Here's an example:
Off:
######
...^.#
######
~~~X..
######
On:
######
~~~~~#
######
~~~~~~
######
This will be represented in the following diagram by an 'R':
i-R-o
|
s
where i is input, o is output, and s is the signal.
Next, we need some logic gates, which make decisions.
A simple AND gate would be something like this:
i-R-R-o
| |
s s
As you can see, both relays need to be on for the water to flow through. This can be summed up in the following logic table:
AND:
0 1
-----
0|0|0|
|-+-|
1|0|1|
-----
An OR gate will be on when either of the inputs is on.
OR:
0 1
-----
0|0|1|
|-+-|
1|1|1|
-----
s
|
-R-
i-| |-o
-R-
|
s
Now, in either of these cases, the input will always be water (or axle power, which can be used for powering pumps), so we can abstract that part of the logic gates out and come up with the following representations:
s-A-s
|
o
s-O-s
|
o
Another useful type of gate is the NOT gate, also called an inverter. This just takes the input and inverts it, so a 1 becomes a 0 and vice versa.
NOT:
s-N-o
This can be made by building a relay with a 1-tile bridge instead of a floodgate.
By sticking one in front of the output of a AND of OR gate, we form a NAND or NOT gate (alternatively, we can replace the floodgates inside those gates with bridges):
NAND:
0 1
-----
0|1|1|
|-+-|
1|1|0|
-----
s-@-s
|
o
NOR:
0 1
-----
0|1|0|
|-+-|
1|0|0|
-----
s-0-s
|
o
Also, we can use just a plain old relay as a gate, called a buffer. This is good for transmitting signals over long distances, so we don't have to have water flow all that way.
s-B-o
And here's something cool: if you put a NOT gate in front of each input of an AND gate, it does the same thing as a NOR gate, and vice versa:
s-N-A-N-s
|
o
=
s-0-s
|
o
;
s-N-O-N-s
|
o
=
s-@-s
|
o
I'll type up another post detailing how to make a binary adding machine.
P.S. I hope you can tell the difference between 'O' for OR and '0' for NOR.