The simplest possible computer
So, if we were going to build a model of the simplest possible computer, where would we start? As it turns out, you probably have such a model in your home already.
Many homes have what's known as a "three-way" switch, which is a light switch that you can turn on and off from two different locations. This circuit can be used as a simple digital computer.
By properly labeling the switch positions and the light bulb, we can use them to solve a logic problem.
Let's say that you need a system to tell you whether to have dessert with your lunch, but you have some specific rules to follow:
1. If you have a salad for lunch, you'll have dessert.
2. If you have soup for lunch, you'll have dessert.
3. If you have both soup and salad for lunch, you'll skip dessert (since you'll be over-full).
4. If you haven't had anything for lunch, you won't have dessert (because dessert on an empty stomach will make you sick).
Here's how to solve this problem with the three-way switch:
If necessary, flip one of the switches so that the light is off. Label the positions that the switches are currently in. Label one "had soup", and the other "had salad". Label the other two positions "no soup" and "no salad", respectively. Hang a sign on the light bulb that reads "have dessert".
Congratulations! You now have a computer that will tell you, based on whether you've had soup and/or salad, whether you should have dessert. Try it out, and you'll find that it follows the rules given above, and the light will only come on if you've had either soup or salad (but not both).
This isn't all that exciting by itself, but this same circuit can be used to solve an entire family of related logic problems, just by changing the labels on the switches and the light bulb. This ability to use the same logic to solve many different problems is the source of the flexibility of computers, and is what enables them to be useful for so many different things.