Answer to Exercise 52

| ANSWER TO EXERCISE 52
    [ DoubleInvSub i count1 count2;
      print "You are carrying ";
      objectloop (i in player)
      {   if (i hasnt worn) { give i workflag; count1++; }
          else { give i ~workflag; count2++; }
      }
      if (count1==0) print "nothing.";
      else
      WriteListFrom(child(player),
          FULLINV_BIT + ENGLISH_BIT + RECURSE_BIT + WORKFLAG_BIT);

      if (count2==0) ".";
      print ".  In addition, you are wearing ";
      objectloop (i in player)
      {   if (i hasnt worn) give i ~workflag; else give i workflag;
      }
      WriteListFrom(child(player),
          ENGLISH_BIT + RECURSE_BIT + WORKFLAG_BIT);
      ".";
    ];

Back to the exercise in section 23

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