Advertisement

computer ai

Started by November 08, 2007 01:34 PM
2 comments, last by sadsack 17 years, 3 months ago
Well I am not sure where to put this, I am very new to C++ and ai. So I will tryed to put it here, but if this is not the right place I will go to the newbe. What I want to do in a very primilive way is to input in to the computer a statment like hello. The computer looks at the input and see if it has a file call hello. If it does has a file "hello' it then prints out what is in this file hello. The way I was thinking how to do this was: 1. input a statement 2. the computer looks at the text," hello,how are you" It see that I have a file that is the same as hello. 3. It then print out the file hello. If there is a better way of doing this let me know. I can make files and print files out. I can save files.I know how to do that. What I need to know is how would I go about to compare the in text from the input and see it I have a file that match some word in the input statement? I am not looking for some one to make the code for me, just point me in the right dir. renny
Not sure whether that's a good way to do it.

Just parse the inputed string for the first occurrence of a '\n', ',', '!', '?' or w/e and delete what comes after it.
Then try to open the file "./answers/" + string + ".txt", if it exists read what's in it and output it to the user, otherwise, make the bot say something random.
Check out my devlog.
Advertisement
Well, if you're using linux, just type "cat hello". If you're on windows, "type hello".
Thank you Wiggin and blueapple
renny

This topic is closed to new replies.

Advertisement