by Fuzzy » Tue Feb 13, 2007 3:53 pm
your best bet would be to parse the words. Divide the input into words and have the program figure them out one by one. Group them into types, and build a generic sentence, or better, segments of a sentence.
For example, "hi" "hello" "hey there" "how are you" are all the same, so you reduce it to "hi" or "greet" internally. from there, you formulate a response. this way, you will not need so many ifs and cases. internally, it might look like...
"<greet> <me>" and from that, you build an response "<greet> <player> <mood>" building the stuff in <> from variables.
So you start with
"Hi there robot how are you?" and respond with "hi Fuzzy, I am fine".
This way, if i say "hi there robot" you respond "hi Fuzzy" and its the exact same code that handles it.
Mortal Enemy of IF....THEN(and Inspector Gadget)
Still ThreeFingerPete to tekdino