I am developing an AI text communication engine, and I was wondering if anyone point me in the direction of a more efficient approach to validating user input other than just switch / if statements.
This is the foundation of it:
void Update(){
string s = Console.Read()s.ToLower();
if (s == "c1"){
// do 1
}
else if (s == "c2"){
// do 2
}
...
else if (s == "c9342"){
// do 9342
}
}
I should add, I have the ability to check for keywords in the sentence.
I feel like due to the fact that all input is strings, and it is dealing with language, this may be the only way to go, but if anyone has any better approach eg. interfaces, custom types, reflection, threading or anything then I am all ears.
Thanks, Andy