CSC 216/s08/diminish fear: Difference between revisions
Amorarmada (talk | contribs) |
|||
(5 intermediate revisions by 4 users not shown) | |||
Line 7: | Line 7: | ||
===The problem=== | ===The problem=== | ||
To teach the student about finite state machines. | To teach the student about finite state machines. A finite state machine(FSM) is defined as a model of behavior composed of a finite number of states, transitions between those states, and actions. | ||
===Participants and props=== | ===Participants and props=== | ||
The participants include those | The participants include those who will volunteer. The props are the students, printed out instructions, and diagram (as seen below). | ||
===The script=== | ===The script=== | ||
Line 22: | Line 22: | ||
2. The professor says he deposits 5 cents. <br /> | 2. The professor says he deposits 5 cents. <br /> | ||
3. The "0 cent" student tells the "current state" student to go to the "5 cents" student.<br /> | 3. The "0 cent" student tells the "current state" student to go to the "5 cents" student.<br /> | ||
4. The professor says he deposits 10 cents.<br /> | 4. The professor says he deposits 10 cents. <br /> | ||
5. The "5 cents" student tells the "current state" student to go to the "15 cents" student.<br /> | 5. The "5 cents" student tells the "current state" student to go to the "15 cents" student.<br /> | ||
6. The professor says he deposits 10 cents.<br /> | 6. The professor says he deposits 10 cents.<br /> | ||
7. The "15 cents" student tells the "current state" student to go to the "25 cents" student.<br /> | 7. The "15 cents" student tells the "current state" student to go to the "25 cents" student.<br /> | ||
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.<br /> | 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.<br /> | ||
===Sample diagram=== | |||
http://www.mcbrosmusic.com/CSC/gumball.png |
Latest revision as of 23:08, 21 April 2008
Formatting Resources
Formatting Help Guide from MetaWiki
The Gumball Finite State Machine
The problem
To teach the student about finite state machines. A finite state machine(FSM) is defined as a model of behavior composed of a finite number of states, transitions between those states, and actions.
Participants and props
The participants include those who will volunteer. The props are the students, printed out instructions, and diagram (as seen below).
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.