Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Artificial intelligence" question in C!!! 2

Status
Not open for further replies.

aboujouj83

IS-IT--Management
May 9, 2003
52
US
I am implemeting a simple client/server TCP program. I want the server to be able to have a very basic discussion with the client i.e to be able to answer few questions like: how are you? what's your name? where do you live? ....

So, I will have to store these questions and some answers for them (that the server will reply with) somewhere.
I am not sure how to do that, because I don't want to use the basic C if-else statments to find out which question the client is asking...

Can I use something like the ROM structure? Any suggestion is very appreciated.

Waiting for your replies
THANKS

Aboujouj
 
I'd like to know the basics of these algorithms i.e how to relate questions and answers and where to store them (using C in a UNIX environment).
Aoujouj
 
May be off base with what you are looking for but what about storing these in a flat files as an array and grabbing the data accordingly. Flat file example below. You can find based on a qualifier. Hope this may at least point you to something.

name, Joe
age old years, 3
"how are you" "how are you doing", fine
 
You might also use two files to do it: one for the questions and the other one for the answers.You would need a search function to search for the questions that the users might enter,this search would be made into the questions file.If you find the sentance that you are searching for into the questions file,you would need to know the line's index( line1,line2,... ) of that specific line and you could use that information to search for the corresponding answer into the answers file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top