| ANSWER TO EXERCISE 21 | |
|
Obviously, a slightly wider repertoire of actions might be a good idea, but:
Object -> Charlotte "Charlotte"
with name "charlotte" "charlie" "chas",
grammar
[; give self ~general;
wn=verb_wordnum;
if (NextWord()=='simon' && NextWord()=='says')
{ give self general;
verb_wordnum=verb_wordnum+2;
}
],
orders
[ i; if (self hasnt general) "Charlotte sticks her tongue out.";
WaveHands: "Charlotte waves energetically.";
default: "~Don't know how,~ says Charlotte.";
],
initial "Charlotte wants to play Simon Says.",
has animate female proper;
(The variable i isn't needed yet, but will be used by the
code added in the answer to the next exercise.)
|