Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualEndurion

Posted 07 September 2012 - 01:44 AM

I'd actually do not direct string comparison. It's easy in the beginning, but will grow too fast to be managable.

Back then the programmer had a list of verb strings (with index so different verbs with the same id existed) and list of object strings.

Then you would parse the input string, split for spaces and try to find all the single words in the lists. The puzzle logic would then analyse the verb and object indices and act accordingly.
If you want to get fancy allow for a secondary object (put xxx in yyy) and fill words that would be discardid ("the", "in", etc.).


Steps:
* Split a string by a separator (space)
* Handle string to index maps (std::map<std::string,int>)

#1Endurion

Posted 07 September 2012 - 01:41 AM

Hell no, no direct string comparison.

Back then the programmer had a list of verb strings (with index so different verbs with the same id existed) and list of object strings.

Then you would parse the input string, split for spaces and try to find all the single words in the lists. The puzzle logic would then analyse the verb and object indices and act accordingly.
If you want to get fancy allow for a secondary object (put xxx in yyy) and fill words that would be discardid ("the", "in", etc.).


Steps:
* Split a string by a separator (space)
* Handle string to index maps (std::map<std::string,int>)

PARTNERS