My basic plan is to have one class that parses through the input buffer and puts each word into a vector. It then finds the token for each word.
There is another class which holds the noun and verb and uses them to call an action.
All the verbs are instances of general verb classes inherited from the base class verb. The base class verb contains the virtual function activate. This function is overridden in each verb type class to perform the specific actions of the verb typ (like attack, add to inventory etc.).
All the pointers to the verb instances through the base class are contained in a vector. The verb token number can be used to access them through their index. The noun token is passed to the activate function so the object can be manipulated by the verb function.
Buffer-contains the input
whitespace-contains the whitespace characters
word-vector of words parsed from buffer
token-vector of tokens taken from the words
Parse[Buffer,#]-returns a word
GetToken[word]-returns a token for the word
inTokens-vector of the tokens parsed from input
getVerb: iterate through inTokens to get the verb
getNoun: iterates through inTokens to get the noun
action: takes the tokens as input and calls the verb class function activate using the verb token as the index to th array of pointers to verbs
There will also be a base class Verb and verb type classes inherited from it.
There will also be a dictionary that can be used to find the tokens and a Noun base class with different nouns.
Well I am just beginning on all this and may be going about it all wrong so I would aprecciate any comments.
I know my plan may not be very clear but I will be working on it more in the next few days.