Next: Objectives
Up: Programming Calibration
Previous: Submission
We abstract the notion of a
FiniteStateMachine and the related
notions of a Stimulus, a Transition,
an Action, and a State.
- FiniteStateMachine
A FiniteStatMachine maintains a set
of States, one of which is designated as the
current State.
A FiniteStatMachine provides the following services:
- addState
a given State is added to the machine;
- initiate
an already given State is designated
as the current one;
- addTransition
a Transition that links two already given States (or an already
given State with itself) is defined for a given Stimulus and
a given Action,
one State is the beginning of the Transition
and the other is the end;
- fire
a Stimulus is given to the FiniteStateMachine, and
if the current State is the beginning of a Transition
with that Stimulus, the current State is changed to the
end State of the Transition and the Action
of the Transition is carried out.
- Stimulus
A Stimulus is a key that selects a Transition
based upon the current State.
- State
A State is an entity that provides the current focus
for a FiniteStateMachine; pairs of States
(or a single State repeated twice) serve as the
beginning and ending of a Transition.
- Action
An Action provides a single service:
- doIt
a procedure with no input that carries out some algorithm
(for the purpose of this assignment, it can merely print a message).
As a test that your Finite State Machine can do something
useful, write a simple example program that uses it to simulate
a coin-operated turnstyle. The turnstyle is initially ``locked.''
In a locked state it cannot be ``rotated.'' Upon ``deposit''
of a coin, it becomes ``unlocked.'' While in an
unlocked state, it will not accept deposit of a coin.
After being rotated (i.e., when a person passes
through), it returns to the locked state.
Next: Objectives
Up: Programming Calibration
Previous: Submission
Mon Sep 9 09:16:07 EDT 1996