ExcitingPress ReviewInteractive fiction · gamebooks

Structure & Craft

From two words to whole sentences: what a text parser could be asked

Early text adventures understood only verb-noun pairs; Infocom's parser accepted full sentences. A counting exercise shows how fast the space of possible commands grows with each extra word class.

A text adventure is a conversation with a parser, the part of the program that decides what you meant. How much the parser could understand shaped everything from puzzle design to how forgiving the game felt. This article puts numbers on that difference.

What the reference says

Wikipedia’s article on interactive fiction says the first text adventure parsers could only handle two-word sentences in the form of verb-noun pairs, and that later parsers, such as those built on Infocom’s ZIL, could understand complete sentences. It gives “open the red box with the green key then go north” as an example of the complexity that is now standard. It says the Infocom parser was widely regarded as the best of its era, accepting commands like “put the blue book on the writing desk” at a time when most competitors’ parsers were restricted to two-word combinations such as “put book”. It adds that later Infocom games would understand multiple-sentence input.

A counting exercise

The numbers below are hypothetical: a small game with 20 verbs, 40 nouns and 5 prepositions. The point is the growth, not the totals.

Command shape Example How the count is made Possible commands
Verb-noun “take lamp” 20 x 40 800
Verb-noun-preposition-noun “put lamp in box” 20 x 40 x 5 x 40 160,000
Two commands in one input “take lamp and open box” 800 x 800 640,000

Each row multiplies in more choices. Adding just one preposition and a second noun multiplies the possible commands by 200 (160,000 / 800). Allowing two commands in a single line multiplies the basic count by 800 again.

Most of those combinations are nonsense in any one scene, and that is the design problem: the parser must either understand them, reject them helpfully, or let the player flounder. A two-word parser handles only the first row and tends to reject the rest as “I don’t understand.”

What changed for the player

  • Less guessing the author’s exact words. With a verb-noun parser, finding the verb the author expected was a puzzle in itself. A fuller parser accepted more of the natural phrasings.
  • More specific puzzles. Actions involving two objects, such as using a key on a box, could be expressed directly.
  • More writing for the author. Each added shape of command requires more responses for the author to write.

The first two points are our reading of the sources’ description, not statements taken from them.

How to see it in play

If you try an early game and then an Infocom title side by side, type the same natural sentence into each, such as “put the book on the table”. Note which understands it, which asks you to rephrase and which gives an unhelpful reply. The difference is the parser’s vocabulary of shapes.

Sources

This article is written for: A reader wants to understand why a better parser changed the feel of text adventures, in numbers rather than adjectives.

AI assistance recorded as: AI draft, not edited. Review status: approved.