The Language of Shadow Land
In Table 14.1, we saw the vocabulary of Shadow Land, but now let's take a look at the productions or syntax rules. Instead of stating them in a rigorous manner, let's try and list them in a bit more of a relaxed way. Let's begin by listing all the words in the vocabulary again:
Let's begin with the legal form of the action verbs. Some of the verbs need no object to mean something. These are "smell," "listen," "inventory," "where," and "exit." If any action verb is typed by itself, it will work. Furthermore, if prepositional phrases, articles, or objects are placed after the verbs, they will have the effect of causing warnings. The outcome of entering any of these verbs follows:
"smell"—This will describe the smell of the room you are in.
"listen"—This will describe the sounds of the room you are in.
"inventory"—This will tell you what you are carrying.
"where"—This will describe your location in the house along with the direction you are facing.
"exit"—This will end the game.
The next set of action verbs can be further qualified by objects, adjectives, or complete prepositional phrases. These verbs are "move," "put," "get," "look," and "eat." Here are the legal forms using some of the earlier production rule syntax:
"move" + (relative direction) | "move" + "to" + relative direction | "move" + "to the" + relative direction
Using the above production, the following sentence would be legal:
"move to the right"
This would have the effect of the player parry right (sidestep). Another possibility would be
This would have the effect making the player walk in the direction he was currently facing. An illegal sentence would be
"move to the east"
This is illegal since "east" is a nautical direction instead of a relative direction. The next interesting action verb is "look." Here is its rule:
"look" +(nautical direction) | "look"+"to"+nautical direction | "look"+"to the"+nautical direction
Using this verb, the player can "see" objects in the room. For example, if the player just typed in "look" without a direction, then the game would print out the static visual only. To see objects in a room, you MUST use "look" combined with a nautical direction. For example, to see the northern part of the room, you would type
"look to the north"
"look to north"
All the above forms are equivalent, and the result of them will be the objects within the player's view being described.
The player will start the game off facing north, so there needs to be a way to turn him. This is done with the "turn" action, which is similar to the "look" verb as far as the production rules go.
"turn" +(nautical direction) | "turn"+"to"+nautical direction | "turn"+"to the"+nautical direction
Hence, to turn East, you can type:
"turn to east"
The next two action verbs relating to object manipulation are "put" and "get." They are used to put down and pick up objects. The only valid objects in the game are the keys, lamp, and sandwich. Here are the production rules for each action verb:
"put"+object | "put" + "down" +"object" | "put"+"down the"+object
"get"+object | "get" + "the" +"object"
"get the keys"
Then later you may wish to drop the keys. This would be accomplished with something like this:
"put down the keys"
The final, most important action verb is "eat," and I'm sure you know what it does. It will make you eat whatever you tell it to as long as you have the object in your possession. The rule for "eat" is
So, if you wanted to eat the lamp, you would type
"eat the lamp"
At first, you will find the grammar and limited vocabulary tedious, but after a few moments of playing the game, it will become very natural to you. You are of course free to add to the vocabulary and grammar rules. One final detail: The input parser is case insensitive, so you can use uppercase and lowercase characters at will.