Here’s a working example along the lines of what Draconis suggests. It has a few rough edges with respect to parser disambiguation, since every possible description of candy matches the pile. Also, this is not robust when abused, e.g. >TAKE RED YELLOW CANDY
[code]“Candy Shop” by “Otis”
[See WWI 10.3 for other examples of interest.]
Color is a kind of value. The colors are red, blue, yellow, and green.
Flavor is a kind of value. The flavors are licorice, bubble gum, pineapple, lemonade, and berry.
A piece of candy is a kind of thing. A piece of candy is usually edible. A piece of candy has a color. A piece of candy has a flavor. The printed name of a piece of candy is usually “piece of [color of the item described] [flavor of the item described] candy”. The plural of piece of candy is pieces of candy. The printed plural name of a piece of candy is usually “pieces of [color of the item described] [flavor of the item described] candy”. Understand “piece” as a piece of candy.
Understand the color property as describing a piece of candy. Understand the flavor property as describing a piece of candy.
There are 12 pieces of candy. [off-stage, upper limit on candy on-stage at once]
Candy Shop is a room.
A giant bin is a fixed in place container in Candy Shop.
A tremendous pile of assorted candy is in the giant bin. Understand “piece” or “piece of” as the tremendous pile. Understand “” as the tremendous pile. Understand “[flavor]” as the tremendous pile.
Rule for clarifying the parser’s choice of the tremendous pile of candy:
say “(from [the tremendous pile])[command clarification break]”.
Instead of taking the tremendous pile of assorted candy (this is the fake assortment rule):
let the protean candy be a random off-stage piece of candy;
if protean candy is nothing:
say “Don’t you think you’ve taken enough candy?” instead;
if the player’s command includes “”:
now the color of the protean candy is the color understood;
otherwise:
now the color of protean candy is a random color;
if the player’s command includes “[flavor]”:
now the flavor of the protean candy is the flavor understood;
otherwise:
now the flavor of protean candy is a random flavor;
now the protean candy is in the giant bin;
try taking the protean candy instead.
After inserting a piece of candy (called lost candy) into the giant bin (this is the recycle candies rule):
now the lost candy is off-stage;
continue the action.
test me with “take candy / i / take blue candy / i / take berry candy / i / take yellow pineapple candy / i”[/code]