Friday, February 10, 2012

The simplest possible computer

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.


4 comments:

Olie said...

XOR for "simplest computer"?!

Simple switch: label up = finished vegetables, down = did not finish vegetables. Light: label eat dessert.

;)

Chum.
(Yes, =that= chum :)

Mark Bessey said...

I actually did think about using that example, or maybe an AND-ed set of switches, but I wanted something that illustrated how a non-trivial set of rules could be resolved by a single logic gate.

This then leads to a discussion of the various types of logic gates, and how more-complex logic can be built out of those blocks.

Paul Van Kirk said...

I like the idea for the book. There certainly is a market for information that demystifies the computer.

One thought: To simplify your illustration, perhaps start by explaining the lighting of the light bulb, then add the labels to show the flexibility of the logic model, and its ability to solve other problems. Otherwise I think you may be making a leap that will still leave some people behind.

will@rd said...

i actually designed a computer based on this :O