MS 5: Synonyms

At this point in your implementation, your debugging sessions will have you wandering through the Adventure game more than you did in the beginning. As a result, you will almost certainly find it convenient to implement the synonym mechanism, so that you can type N, S, E, and W instead of the full names for the compass directions. The format of the Synonyms file is described here.

To implement the synonym processing, you need to read through the Synonyms file and create a dictionary attribute in the AdvGame class that contains the synonym definitions. Then, whenever you read a word–which might be a motion verb, an action verb, or the name of an item–you need to see if that word exists in the synonym dictionary and, if so, substitute the standard definition before continuing with your program.

As the with the Items file, it is not an error if the Synonyms file is missing. In that case, the synonym dictionary should just be empty.