??ANSWER TO EXERCISE 1

Change the mushroom's after rule to:

       after
       [;  Take: if (self hasnt general)
                 {   give self general;
                    "You pick the mushroom, neatly cleaving its thin stalk.";
                 }
                 "You pick up the slowly-disintegrating mushroom.";
           Drop: "The mushroom drops to the ground, battered slightly.";
       ],
As mentioned above, general is a general-purpose attribute, free for the designer to use. The 'neatly cleaving' message can only happen once, because after that the mushroom object must have general. Note that the mushroom is allowed to call itself self instead of mushroom.

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