This content was published by Andrew Tomazos and written by several hundred members of the former Internet Knowledge Base project.

Fan Algorithm

Here's a simple example of an algorithm. If you have a ceiling fan with several speeds including off, each setting of which is determined by the momentary switching of a pull cord, you must determine what effect a single pull of the cord has on the fan's settings in order to begin to learn to control the fan. Then you must repeat the process until you have determined how each pull affects the fan's behavior until you have identified the number of pulls necessary to step the fan through each of its speed settings and back to off. After you've determined that you can recognize the setting of the fan by observing its condition, then you can determine the number of pulls that will be necessary to achieve the desired fan state, and make that number of pulls without waiting to determine what effect each individual pull had on the fan's current setting. Using a predetermined number of pulls to control the fan without waiting to observe the effect of each pull is using an algorithm.

Back to Index