Answer to Exercise 29

| ANSWER TO EXERCISE 29
    Object Zen "Zen" Flight_Deck
      with name "zen" "flight" "computer",
           initial "Square lights flicker unpredictably across a hexagonal
                    fascia on one wall, indicating that Zen is on-line.",
           grammar [;  return -'zen,'; ],
           orders
           [;  Show: "The main screen shows a starfield,
                      turning through ", noun, " degrees.";
               Go:  "~Confirmed.~  The ship turns to a new bearing.";
               SetTo: if (noun==0) "~Confirmed.~  The ship comes to a stop.";
                   if (noun>12) "~Standard by ", (number) noun,
                                " exceeds design tolerances.~";
                   "~Confirmed.~  The ship's engines step to
                    standard by ", (number) noun, ".";
               Take: if (noun~=force_wall) "~Please clarify.~";
                    "~Force wall raised.~";
               Drop: if (noun~=blasters)   "~Please clarify.~";
                  "~Battle-computers on line.
                    Neutron blasters cleared for firing.~";
               NotUnderstood: "~Language banks unable to decode.~";
               default: "~Information. That function is unavailable.~";
           ],
      has  talkable proper static;
    Object -> force_wall "force wall"     with name "force" "wall" "shields";
    Object -> blasters "neutron blasters" with name "neutron" "blasters";
    ...
    Verb "zen,"   * "scan" number "orbital"        -> Show
                  * "set" "course" "for" Planet    -> Go
                  * "speed" "standard" "by" number -> SetTo
                  * "raise" held                   -> Take
                  * "clear" held "for" "firing"    -> Drop;
Dealing with `Ask`, `Answer` and `Tell` are left to the reader.

Back to the exercise in section 16

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.