1
<HTML><HEAD><TITLE>Answer to Exercise 29</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 29</B><TR><TD><TD>
8
Object Zen "Zen" Flight_Deck
9
with name "zen" "flight" "computer",
10
initial "Square lights flicker unpredictably across a hexagonal
11
fascia on one wall, indicating that Zen is on-line.",
12
grammar [; return -'zen,'; ],
14
[; Show: "The main screen shows a starfield,
15
turning through ", noun, " degrees.";
16
Go: "~Confirmed.~ The ship turns to a new bearing.";
17
SetTo: if (noun==0) "~Confirmed.~ The ship comes to a stop.";
18
if (noun>12) "~Standard by ", (number) noun,
19
" exceeds design tolerances.~";
20
"~Confirmed.~ The ship's engines step to
21
standard by ", (number) noun, ".";
22
Take: if (noun~=force_wall) "~Please clarify.~";
23
"~Force wall raised.~";
24
Drop: if (noun~=blasters) "~Please clarify.~";
25
"~Battle-computers on line.
26
Neutron blasters cleared for firing.~";
27
NotUnderstood: "~Language banks unable to decode.~";
28
default: "~Information. That function is unavailable.~";
30
has talkable proper static;
31
Object -> force_wall "force wall" with name "force" "wall" "shields";
32
Object -> blasters "neutron blasters" with name "neutron" "blasters";
34
Verb "zen," * "scan" number "orbital" -> Show
35
* "set" "course" "for" Planet -> Go
36
* "speed" "standard" "by" number -> SetTo
37
* "raise" held -> Take
38
* "clear" held "for" "firing" -> Drop;
41
Dealing with <TT>Ask</TT>, <TT>Answer</TT> and <TT>Tell</TT> are left to the reader.
43
<HR>Back to <A HREF="../section16.html#ex29">the exercise in section 16</A><HR>
44
<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>