|
Your current implementation seems ineffective to me.
I don't know precisely what the difference is between "examine" and "look". If they're synonyms, they should have some relationship that is distinct from the relationship with "jump".
You might want to consider lists of lists, or something similar. For instance, the first list in verbs would contain "examine" and "look" and the second list would contain "jump" (and possibly "leap").
The first list in nouns (for "head") might contain "you see a head" and "you have just crushed a head and exposed a florb buried within", depending upon whether you were looking or jumping. The second (for "basket") might contain "you see a large basket, its bottom obscured by a thin layer of smoke" and "you have just jumped into a large basket, slid down the side, fallen through a hole, and are in the basement".
By making these things objects, you can exercise fine control in a tight locale without splattering complex conditionals throughout the code. You may have a parent basket with generalized basket-features from which you derive small baskets that get crushed when jumped on, or large baskets that one might jump into. You know where to put the actions, and it isn't throughout the code at each place where a basket is encountered.
In other words, you don't need tons of conditionals to determine the type of an object, when it's encountered, so that you may select an appropriate action. The action was determined when you invented the object and described its characteristics and actions. When an object of that type is encountered, it knows what to do.
|