??ANSWER TO EXERCISE 4

Put any validation rules desired into the GamePreRoutine. For example, the following will filter out any stray Drop actions for unheld objects:

[ GamePreRoutine;
  if (action==Drop && noun notin player)
      "You aren't holding ", (the) noun, ".";
  rfalse;
];

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