Virtual Pest "Startup Kit"

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, the Wonder Dog

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.

Sound:

Action:

The pest's state: Normally, this item is hidden Step counter:


Finite State Machine:


Behavior Table:

Element

Type

Possible values

Meaning

Action

PetSound

text box

Grrr...
Woof woof

state=angry
state= lonely

OwnerHand

button

pat the dog

changes state to "provoked" if angry, and to "happy" if lonely.

PetAction

text box

Bite
Wag Tail

state=provoked
state= happy

...

...

...

...

...