DEV website instance!

Player vocabulary

The game specification does not tell us what actions the player must be able to perform. This being a minimalist implementation, we'll declare only the bare essentials. For example the player is originally wearing the cloak; do they need to REMOVE it before dropping it or hanging it on the hook? No. They clearly need to be able to pick the cloak up if they'd dropped it, but there no need to allow them to wear it again – so no WEAR either. Only actions clearly implied by the specification will be catered for.

While A-code player command interface is at present restricted to the ancient verb/noun structure (no adjectives, prepositions or instruments), it also permits apparently complex commands, e.g. "drop everything except the ring and the orb then go out". This is achieved by the parser reducing such complex command to a series of one or two word simple ones. However, in constructing a game one can also cheat: in so far as adjectives are not necessary to identify objects, they can be simply ignored.

All vocabulary words are automatically abbreviable to the smallest unambiguous length. By default, the A-code parser will also do approximate, one-typo matching of player's command words against the vocabulary, but in this tutorial we'll be switching approximate matching off, in order to avoid complications of dealing with ambiguous typos and such-like.

Note that in the absence of any clashing vocabulary words (including objects, which I have not tackled yet), the four direction commands will be automatically abbreviable to their first letter.

So, verbs available to the player:

# Game specification mandates just the four cardinal directions
verb NORTH
verb EAST
verb SOUTH
verb WEST
#
verb GET, TAKE    # Both the player and game code can use these interchangeably
verb INVENTORY
verb DROP
verb READ         # For reading the message in the bar room
verb HANG         # To hang the cloak on the hook
verb LOOK
verb QUIT         # Not in the spec, but every game should allow quitting
#
noise THE, THAT, VELVET, GO     # Player command words to be ignored

The NOISE definition tells the game which words in player's command are to be completely ignored. Thus GET THE VELVET CLOAK will be parsed as GET CLOAK, despite the parser's limitation to verb/noun commands. Similarly GO WEST will become simply WEST, which somewhat simplifies game's code.

I sneaked in another feature here: comments. Comments are delimited by the hash sign. Full-line comments (with the # sign being the line's first character) are permitted everywhere – even within message or description texts. They are simply ignored. In-line comments are not allowed in texts (be it game's messages or object/place descriptions).

Previous page            Next page


Back to the tutorial index
To the Mipmip home page
Feel free to leave a comment!
Mike Arnautov (06 May 2025)