Skip to content
עברית

Text adventures and the two-word parser

Definition

A two-word parser is how early text adventure games turned a line of text the player typed into an action in the game: one verb and one noun, nothing more. Scott Adams was already using this method in 1978. There was no machine learning in it at any stage: the program only compared the typed word to a closed, predefined list of known words. It is an "illusion of understanding": a rule-based system that knows only what it was programmed to know, not a system that understands language.

💡 Example

The player types: TAKE LAMP

The computer understands: verb=TAKE, noun=LAMP → picks up the lamp.

The player types: PLEASE GIVE ME THE LAMP

The computer understands: nothing. The parser checks only the first two words, and PLEASE is not a verb it knows. So it replies that it doesn't understand the command, even though the meaning is perfectly clear to a person reading it.

How a two-word parser actually works

Every command the player types goes through a fixed process. The program splits the line into words, compares the first word to the list of verbs it knows (NORTH, TAKE, DROP, GO and so on), and the second word to the list of nouns (LAMP, KEY, DOOR). If both words are on the lists, the parser triggers an action programmed in advance for them. If not, it prints an error message. Because of the memory limits of home computers in the late 1970s, Adams's parser cut corners even further: according to Wikipedia, it actually checked only the first three letters of each word. So a short, careless entry like LIG LAM was read exactly like LIGHT LAMP. This saved memory, at the cost of accuracy.

Under the hood: from words to numbers

Real code for such a parser, published in START magazine in 1986 (in the C programming language), shows a three-step process. A function called split_word() separates the first word from the typed line. A function called scan_commands() compares it to a fixed list of verbs, and returns its position in the list as a "token": a number, not text. NORTH, for example, might be token number 1. A matching function, scan_objects(), does the same for the noun. If either comparison fails, the function returns zero, and the game prints that it didn't understand. The difference between GIVE THE BOOK TO THE ALIEN and GIVE THE ALIEN THE BOOK shows exactly why two words are not enough for a complex sentence. In both sentences the result is the same, and the alien gets the book, but the order of the objects is reversed, and the second one also lacks the preposition TO. According to the magazine itself, decoding sentences like these requires at least a basic understanding of the parts of an English sentence.

What this parser can't do, and what that teaches us

A two-word parser cannot understand a sentence like PLEASE GIVE ME THE LAMP. It doesn't look for a verb and a noun anywhere in the sentence; it checks only the first two words, and PLEASE is not a known verb. Words linking commands together, which appeared only in more advanced parsers, did not exist for it either. This was not a one-off glitch but a built-in limitation: the system recognizes words, not syntax and not intent. Put simply, this is not artificial intelligence as we understand it today, but an illusion of understanding: rigid rules that look like a conversation from the outside.

The leap to full sentences: Zork and The Hobbit

In 1977, four people at MIT (three students and a staff member) began writing Zork. Its parser was designed to understand commands far more complex than two words, for example PUT THE LAMP AND SWORD IN THE CASE, with a preposition and an "and" joining two nouns. In 1979 some of them founded Infocom to distribute the game commercially. In 1982 Melbourne House published The Hobbit, developed in Australia by Beam Software. The game had a parser called Inglish, which understood full sentences, pronouns, adverbs, prepositions and punctuation. According to Wikipedia's article on the game, it understood, for example, the command "ask Gandalf about the curious map then take sword and kill troll with it". Both games remained rule-based, just like Adventureland, except that their rules were much richer. According to Wikipedia's article on Zork, a reviewer for Softalk magazine noted in 1981 that every other game since Colossal Cave Adventure had limited players to just two words. 80 Micro magazine even wondered whether Zork could ever be completed, because of how much its parser allowed. The competition was direct: according to Wikipedia's article on Adventure International, Scott Adams's own company, it quickly lost market share when graphical adventures like The Hobbit raised expectations, and its own graphical adventures were considered inferior by comparison.

From the rules of the past to today's intent recognition

The two-word parser is a direct ancestor, rule-based rather than learning-based, of two fields every modern chatbot relies on: natural language processing and intent recognition. Intent recognition is how a system decides what the user wants to do, not just which words they wrote. ELIZA, the early chat program from 1966, worked on a similar principle: spotting keywords, not understanding. SHRDLU, from 1970, extended the idea to a limited world of blocks, with a larger but still closed vocabulary. And in 2019 came AI Dungeon, which replaced the closed word list with a large language model that generates a free-form response to any text. The response is not always right, but it is no longer limited to a list of words.

Why this category starts here

Early adventure games are a natural starting point for this category. In them, ordinary people, not only researchers in a lab, first ran into a question that is still at the heart of AI: how do you know whether a computer "understood" you, and didn't just respond correctly? The two-word parser gave a clear answer: it did not understand; it matched words to a closed list. But the illusion it created, the feeling that a real conversation is taking place, is still with anyone who uses chatbots based on language models today, only far more powerfully.

FAQ ❓

What exactly is a "parser" in an adventure game?

The program that translates what the player typed into an action in the game. In its simplest form, it matches one verb and one noun to a predefined list.

Why doesn't PLEASE GIVE ME THE LAMP work in a game like this, when TAKE LAMP does?

Because the parser checks only the first two words, looking for a verb followed by a noun. GIVE might be a known verb, but PLEASE comes before it and is not a verb, so the parser gets stuck on the very first word.

Was this artificial intelligence in today's sense?

No. There is no learning from examples and no neural network, only fixed, predefined rules that compare words. The "understanding" the player felt was an illusion, not real language ability.

How were Zork and The Hobbit different from the two-word parser?

Both understood much more complex sentences, with prepositions, pronouns and commands joined by "and". But they remained rule-based, not learning-based.

What is the connection between these parsers and today's chatbots?

They are a conceptual ancestor of intent recognition and natural language processing: the attempt to understand what the user wants from the text they typed. The key difference is that the old parsers followed hand-written rules, while today's language models learn from examples.

Found a mistake, or have a source we should add? Write to us