What is the different with prolog, clip and other languages e.g C#
Hi
I know prolog and clip is used in AI for reasoning, machine learning etc (I don't really know much). Do game programming for AI using those language or other type of languages to implement the AI stuff e.g. Street fighter, how the computer should react when the player punch it.
Can anyone explain what did prolog and clip use for? Is there anything prolog can solve and clips can't or the other way round?
I have much more experience with Prolog than CLIPS, so I will mainly comment on that. Prolog is a logic (or rule-based) programming language. C++ is declarative but can also be object oriented. C# is similar to Java in that it is object oriented.
In basic prolog, all you are doing is specifying rules and facts. For example, you have facts: John is Johnny's father. And you have rules: if X is Y's father then X is Y's parent.
The interpreter, unlike languages such as C#, doesn't care what order these rules or facts are in. To use the program, the user can ask the system a question: is John Johnny's father? If the fact doesn't exist outright, the rules must be checked. For this example, "true" or "yes" will be returned. The data can get really complex, and through this new facts can be learned by applying the rules to them and asking various questions.
This is what Prolog was designed to do: turn programming into 'mathematical logic' rather than computer instructions. You can begin writing facts/rules into a Prolog interpreter and asking questions in under a minute. Doing this in C# will take quite a bit more time, especially if you get to more advanced logic rules.
As with CLIPS, this was created for the purposed of use in expert systems. i.e. you create a large database of rules/facts, and the user can ask the system questions. The system is an 'expert' because it knows 'all there is to know' on the subject. The user 'consults' with the system, and retrieves an answer based on everything the system knows. Common applications for these can be seen in the medical field and the diagnosis of problems (i.e. giving the system the symptoms of a patient, it will return the possible conditions of the patient).
In games such as Street Fighter, the AI is extremely basic. I am not sure what language SF was developed in, but I am quite confident that this same language was used for AI development. Street Fighter characters do no learning. They have the same basic handful of moves that they execute. This is all likely pure declarative programming: if the user's health is lower, execute this move; randomly generate a number to decide which move to throw; stuff like that.
Keep in mind that the basic AI needed in most games can be done in any common language (C++, C#). Prolog or CLIPS would be overkill.
In basic prolog, all you are doing is specifying rules and facts. For example, you have facts: John is Johnny's father. And you have rules: if X is Y's father then X is Y's parent.
The interpreter, unlike languages such as C#, doesn't care what order these rules or facts are in. To use the program, the user can ask the system a question: is John Johnny's father? If the fact doesn't exist outright, the rules must be checked. For this example, "true" or "yes" will be returned. The data can get really complex, and through this new facts can be learned by applying the rules to them and asking various questions.
This is what Prolog was designed to do: turn programming into 'mathematical logic' rather than computer instructions. You can begin writing facts/rules into a Prolog interpreter and asking questions in under a minute. Doing this in C# will take quite a bit more time, especially if you get to more advanced logic rules.
As with CLIPS, this was created for the purposed of use in expert systems. i.e. you create a large database of rules/facts, and the user can ask the system questions. The system is an 'expert' because it knows 'all there is to know' on the subject. The user 'consults' with the system, and retrieves an answer based on everything the system knows. Common applications for these can be seen in the medical field and the diagnosis of problems (i.e. giving the system the symptoms of a patient, it will return the possible conditions of the patient).
In games such as Street Fighter, the AI is extremely basic. I am not sure what language SF was developed in, but I am quite confident that this same language was used for AI development. Street Fighter characters do no learning. They have the same basic handful of moves that they execute. This is all likely pure declarative programming: if the user's health is lower, execute this move; randomly generate a number to decide which move to throw; stuff like that.
Keep in mind that the basic AI needed in most games can be done in any common language (C++, C#). Prolog or CLIPS would be overkill.
Thanks for your reply....
Hmmm the games like chess shouldn't it have complex AI in it... or is that very easy too.
Hmmm the games like chess shouldn't it have complex AI in it... or is that very easy too.
Actually, by paradigm, Prolog is a declarative language, and C++ is an imperative language. But besides this, Doggan is absolutely correct.
Prolog is a restricted form of first order logic. Prolog rules are Horn clauses, with a conjunction of preconditions on the left hand side of an implication and a single conclusion on the right.
Prolog also makes use of a backtracking algorithm and pattern matching/unification, both of which are absent in C++.
Actually, Prolog does care what order the rules are in. Consider:
test_rule(_) :- write('Hello'), nl.
test_rule(operator(X)) :- write('Operator passed'), nl.
for example.
The second clause may as well not be there, as it's completely eclipsed by the first. The order isn't as important as in C++, but it still matters.
If you're writing a typical search tree for a game's AI, you probably wouldn't use Prolog. If you were trying to solve a constraint satisfaction problem, perform theorem proving or attempt to parse some natural language, then you'd use Prolog.
Prolog also makes use of a backtracking algorithm and pattern matching/unification, both of which are absent in C++.
Quote:
The interpreter, unlike languages such as C#, doesn't care what order these rules or facts are in.
Actually, Prolog does care what order the rules are in. Consider:
test_rule(_) :- write('Hello'), nl.
test_rule(operator(X)) :- write('Operator passed'), nl.
for example.
The second clause may as well not be there, as it's completely eclipsed by the first. The order isn't as important as in C++, but it still matters.
If you're writing a typical search tree for a game's AI, you probably wouldn't use Prolog. If you were trying to solve a constraint satisfaction problem, perform theorem proving or attempt to parse some natural language, then you'd use Prolog.
Quote: Original post by kbundy
Thanks for your reply....
Hmmm the games like chess shouldn't it have complex AI in it... or is that very easy too.
I've never used Prolog of CLIPS, but based on what has been said in this thread I would not use either to write a chess program.
This doesn't mean you couldn't use either to write a chess program, just that _I_ wouldn't.
The 'AI' behind most chess programs might surprise you. :) I try to describe it in laymans terms on my website at http://www.nentari.com/computer_chess.htm.
I would love to see a Chess program written in LOGO. :)
Will
------------------http://www.nentari.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement