CSC 216/s08/clever imaginings: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
==Finite State Machines and the State Pattern== | ==Finite State Machines and the State Pattern== | ||
===The problem=== | ===The problem=== | ||
Finite state machines are abstract models of systems that have a set number of states, inputs, and rules for transitioning from one state to another. Understanding all the parts of a FSM can be difficult, especially in systems that feature a large number of states and transitions. | Finite state machines are abstract models of systems that have a set number of states, inputs, and rules for transitioning from one state to another. Understanding all the parts of a FSM can be difficult, especially in systems that feature a large number of states and transitions. As an interesting application, a Finite State Machine can be used to model the emotional states of an Non-Player Character (NPC) in video games. | ||
===Participants and props=== | ===Participants and props=== | ||
Students should work in pairs. In Part 1, one student will act as the FSM, and the other will act as the environment. The student acting as the FSM should reference the following table (which may be printed on a notecard) to determine their reaction to stimuli. | |||
{| border="1" cellspacing="0" cellpadding="5" | |||
! | |||
! Compliment | |||
! Dull Comment | |||
! Insult | |||
|- | |||
| '''Amicable''' | |||
| Amicable | |||
| Neutral | |||
| Neutral | |||
|- | |||
| '''Neutral''' | |||
| Amicable | |||
| Neutral | |||
| Agitated | |||
|- | |||
| '''Agitated''' | |||
| Neutral | |||
| Agitated | |||
| Agitated | |||
|} | |||
The other student should use the following list of generic insults, compliments and dull comments: | |||
{| border="1" cellspacing="0" cellpadding="5" | |||
! Compliments | |||
! Dull Comments | |||
! Insults | |||
|- | |||
| | |||
*"You have a lovely smile." | |||
*"Your intellect astounds me." | |||
*"You move very gracefully." | |||
| | |||
*"The weather is nice today." | |||
*"That desk looks heavy." | |||
*"Space travel is boring." | |||
| | |||
*"You disgust me." | |||
*"Clearly, you don't understand." | |||
*"Please be quiet, the adults are talking." | |||
|} | |||
===The script=== | ===The script=== | ||
====Part 1: The Finite State Machine==== | ====Part 1: The Finite State Machine==== | ||
====Part 2: Extending with the State Pattern==== | ====Part 2: Extending with the State Pattern==== |
Revision as of 02:19, 21 April 2008
Finite State Machines and the State Pattern
The problem
Finite state machines are abstract models of systems that have a set number of states, inputs, and rules for transitioning from one state to another. Understanding all the parts of a FSM can be difficult, especially in systems that feature a large number of states and transitions. As an interesting application, a Finite State Machine can be used to model the emotional states of an Non-Player Character (NPC) in video games.
Participants and props
Students should work in pairs. In Part 1, one student will act as the FSM, and the other will act as the environment. The student acting as the FSM should reference the following table (which may be printed on a notecard) to determine their reaction to stimuli.
Compliment | Dull Comment | Insult | |
---|---|---|---|
Amicable | Amicable | Neutral | Neutral |
Neutral | Amicable | Neutral | Agitated |
Agitated | Neutral | Agitated | Agitated |
The other student should use the following list of generic insults, compliments and dull comments:
Compliments | Dull Comments | Insults |
---|---|---|
|
|
|