< previous page page_270 next page >

Page 270
(text box continued from previous page)
All around us are devices that can be modeled as finite state machinestraffic lights, automatic transmissions, washing machines, and elevators, for example. Each has specific states of operation and a set of rules for switching among them. In the following traffic light state diagram, notice that the lights are set to blinking red from 1:00 A.M. to 6:00 A.M.
0270-01.gif
Finite state machines are not general-purpose computers. There are many problems that they cannot solve. But when a problem can be modeled as a set of states and transition rules, we can use a standard approach to writing an algorithm that solves it. Many of these problems are most easily solved with means-ends analysis, which we described in Chapter 1.
Let's rework the NotEqualCount program as a finite state machine. Here's the state diagram of the problem:

(text box continues on next page)

 
< previous page page_270 next page >