Right after the Second World War the need arose for a simple set of rules, and if you'd follow those carefully, you'd be able to solve any mathematical problem. This would greatly simplify difficult problems and mitigate errors.
Alan Turing called his invention the Turing Machine and this is how it works. A Turing machine has three components, a read/write head (can either write a 1 or a 0), a strip of tape, and a set of cards. The head can move to locations on the tape, read what the location contains and write or overwrite the value. The cards define in the following order; what to write, which direction to move in and which card contains the next instruction. These definition can be different whether a 1 or a 0 is read.
A Simple card would look something like this:
When I read: | Write: | Move left or right? | Next instructions are on card: |
---|---|---|---|
0 | 1 | 0 | 0 |
1 | 0 | 1 | 0 |
This card basically tells us the following:
If I see a 0, I write a 1, move to the left and halt.
If I see a 1, I write a 0, move the the right and halt.
This almost seems to simple to produce a usable output, but once you start adding cards, the machine becomes more and more complex. You can add any amount of cards you like, resulting in an infinite amount of possibilities.
Little did Turing know, he laid the foundations for the computer. Computers incorporate a similar technique to run software.