September 7th, 2003, 03:03 PM
I was sitting around one day and came up with this idea:
A "bot" that you could input text to like, "My keys are in my car", then you could ask a question like, "Where are my keys?" and the "bot" would say, "Your keys are under your car".
I know Perl is probably the language for this, but how hard would it be to do in C... I don't know where to start...
September 7th, 2003, 03:12 PM
"your keys are in your car"
September 7th, 2003, 05:35 PM
I think that you are 30 years late with that idea!:rolleyes: What you are talking about is called an 'expert system'. Neither Perl nor C++ are the most appropriate language. Prolog would be the language for that. In fact that is what Prolog does, so you would not need to code anything much other than the user interface!
For a quick introduction to Prolog see: Fundamental Prolog (Part 1)
The same site has more tutorials: Visual Prolog Tutorials
You can download the free Personal Edition of Visual Prolog from the site. http://www.visual-prolog.com.
However, what might be an interesting exercise is to write your own Prolog style inference engine in C or C++. It would be a purely academic exercise of course. I suggest you learn more about Prolog and what it does and how before you re-invent the wheel.
September 7th, 2003, 06:32 PM
hey thanks for the links Cilfford, that seems like a very interesting language... [adds Prolog to the neverending list of things to learn]
here is a link to the GNU version if your on linux like me:
September 7th, 2003, 06:56 PM
September 7th, 2003, 09:12 PM
Did a project in Prolog for a class about 15 years. It was a kind of genealogy utility in which we first defined who married whom and then whom they begat. Then you would enter two individuals and it would tell you how they were related. We ran it in Borland's Turbo Prolog. BTW, I have no idea where the code is now.
At the very first, it was quite a paradigm shift away from procedural languages. But then I got the hang of it (which didn't take that long) the fairly lengthy program almost wrote itself. And worked almost the first time. The only problem I had was implementing something like a for loop, because prolog would do it as a recursive call, but then when you returned back out of all those recursive calls, the program would have forgotten what the values were in the inner-most call.
September 8th, 2003, 05:29 AM