CSC 216/s08/diminish fear: Difference between revisions
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
===The script=== | ===The script=== | ||
A simple example that can be used to demonstrate the finite state machine is a candy dispenser. This is a special kind of candy dispenser that only takes dimes and nickels. Every item in the dispenser cost 20 cents. Assign one of the volunteers to be the current state. Everyone else becomes a different state. In this example, there are 6 different states: 0 cents, 5 cents, 10 cents, 15 cents, and 20 cents, 25 cents. | |||
Once everyone has been assigned a state, display the state transition diagram. The professor then should give input values and have the students run through the simulation with the "current state" student standing next to the correct "state" student. | |||
Here is an example run through. | |||
1. The "current state" student stands next to the "0 cent" state. | |||
2. The professor says he deposits 5 cents. | |||
3. The "0 cent" student tells the "current state" student to go to the "5 cents" student. | |||
4. The professor says he deposits 10 cents. | |||
5. The "5 cents" student tells the "current state" student to go to the "15 cents" student. | |||
6. The professor says he deposits 10 cents. | |||
7. The "15 cents" student tells the "current state" student to go to the "25 cents" student. | |||
8. The "25 cent" student tells the "current state" student to go to the "0 cent" student. This student should also announce that the machine should dispense the candy and also give 5 cents worth of change back. |
Revision as of 03:28, 16 April 2008
Formatting Resources
Formatting Help Guide from MetaWiki
Place Title of Exercise Here
Give the title of your exercise, which may include the name of the topic you are covering, or some other catchy title.
The problem
Describe what you are attempting to teach students by this exercise.
Participants and props
How many students will participate? What else do you need (e.g., old tennis ball, Powerpoint slides, software).
The script
A simple example that can be used to demonstrate the finite state machine is a candy dispenser. This is a special kind of candy dispenser that only takes dimes and nickels. Every item in the dispenser cost 20 cents. Assign one of the volunteers to be the current state. Everyone else becomes a different state. In this example, there are 6 different states: 0 cents, 5 cents, 10 cents, 15 cents, and 20 cents, 25 cents.
Once everyone has been assigned a state, display the state transition diagram. The professor then should give input values and have the students run through the simulation with the "current state" student standing next to the correct "state" student.
Here is an example run through.
1. The "current state" student stands next to the "0 cent" state.
2. The professor says he deposits 5 cents.
3. The "0 cent" student tells the "current state" student to go to the "5 cents" student.
4. The professor says he deposits 10 cents.
5. The "5 cents" student tells the "current state" student to go to the "15 cents" student.
6. The professor says he deposits 10 cents.
7. The "15 cents" student tells the "current state" student to go to the "25 cents" student.
8. The "25 cent" student tells the "current state" student to go to the "0 cent" student. This student should also announce that the machine should dispense the candy and also give 5 cents worth of change back.