I'm new to Prolog. I'v got only 1 question: How can I start with Prolog using Visual Prolog?
I currently have:
- Visual Prolog 7.1 installed
- Made a new project
- Build the project
- Opened main.pro
main.pro:
And I have the following code:
I tried the following:
But it doesn't work. I only need a little explanation, how I can start using this code. (It's from Ivan Bratko - Programming for Artificial Intelligence - Fig. 1.8)
I currently have:
- Visual Prolog 7.1 installed
- Made a new project
- Build the project
- Opened main.pro
main.pro:
Code:
implement main
open core
constants
className = "main".
classVersion = "".
clauses
classInfo(className, classVersion).
clauses
run():-
console::init(),
succeed(). % place your own code here
end implement main
goal
mainExe::run(main::run).
And I have the following code:
Code:
parent( pam, bob).
parent( tom, bob).
parent( tom, liz).
parent( bob, ann).
parent( bob, pat).
parent( pat, jim).
female( pam).
male( tom).
male( bob).
female( liz).
female( ann).
female( pat).
male( jim).
offspring( Y, X) :-
parent( X, Y).
mother( X, Y) :-
parent( X, Y),
female( X).
grandparent(X, Z) :-
parent( X, Y),
parent( Y, Z).
sister( X, Y) :-
parent( Z, X),
parent( Z, Y),
female( X),
different( X, Y).
predecessor(X,Z ) :-
parent( X, Z).
predecessor( X, Z) :-
parent( X, Y),
predecessor(Y, Z).
I tried the following:
Code:
implement main
open core
constants
className = "main".
classVersion = "".
clauses
classInfo(className, classVersion).
clauses
run():-
console::init(),
succeed(). % place your own code here
parent( pam, bob).
parent( tom, bob).
parent( tom, liz).
parent( bob, ann).
parent( bob, pat).
parent( pat, jim).
female( pam).
male( tom).
male( bob).
female( liz).
female( ann).
female( pat).
male( jim).
offspring( Y, X) :-
parent( X, Y).
mother( X, Y) :-
parent( X, Y),
female( X).
grandparent(X, Z) :-
parent( X, Y),
parent( Y, Z).
sister( X, Y) :-
parent( Z, X),
parent( Z, Y),
female( X),
different( X, Y).
predecessor(X,Z ) :-
parent( X, Z).
predecessor( X, Z) :-
parent( X, Y),
predecessor(Y, Z).
end implement main
goalAnd
mainExe::run(main::run).
But it doesn't work. I only need a little explanation, how I can start using this code. (It's from Ivan Bratko - Programming for Artificial Intelligence - Fig. 1.8)