1
<HTML><HEAD><TITLE>Answer to Exercise 21</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
3
<TABLE><TR><TD Valign="top"><IMG SRC="../icons/exercise.gif" ALT="??"><TD bgcolor="#FAA89B"><B>ANSWER TO EXERCISE 21</B><TR><TD><TD>
7
Obviously, a slightly wider repertoire of actions might be a good idea,
10
Object -> Charlotte "Charlotte"
11
with name "charlotte" "charlie" "chas",
13
[; give self ~general;
15
if (NextWord()=='simon' && NextWord()=='says')
17
verb_wordnum=verb_wordnum+2;
21
[ i; if (self hasnt general) "Charlotte sticks her tongue out.";
22
WaveHands: "Charlotte waves energetically.";
23
default: "~Don't know how,~ says Charlotte.";
25
initial "Charlotte wants to play Simon Says.",
26
has animate female proper;
29
(The variable <TT>i</TT> isn't needed yet, but will be used by the
30
code added in the answer to the next exercise.)
32
<HR>Back to <A HREF="../section16.html#ex21">the exercise in section 16</A><HR>
33
<SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>