This page presents a "skeleton page" for a "minimal virtual pest" for use in CS 390:61-70, Fall 2000, assignments Virtual Pest I, Virtual Pest II, Virtual Pest III.
Included in the page source are functions that:
You may use these functions as guides to programming your own virtual pest.
JL Popyack, Nov. 1998. Updated Nov. 1999, 2000
Tralfaz behaves according to the finite-state machine and behavior table shown at the end of this document. There are four possible states. The state is updated once per second.
Click the button to pat Tralfaz when state is either "lonely" or "angry". When "happy" or "provoked", the state changes randomly; clicking the button will have no effect in these states.
Element |
Type |
Possible values |
Meaning |
Action |
---|---|---|---|---|
PetSound |
text box |
Grrr... |
state=angry |
|
OwnerHand |
button |
|
pat the dog |
changes state to "provoked" if angry, and to "happy" if lonely. |
PetAction |
text box |
Bite |
state=provoked |
|
... |
... |
... |
... |
... |