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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need an assignment to study my final exam

Status
Not open for further replies.

zxcxz

Programmer
Jan 4, 2007
4
TR
Hi to all.

I've to find an assignment to study my final exam. It's about prolog programming and relationships. For example :

X is father, Y is mother. If A and B is a child of X and Y, they're brother. Another example; if C is A's grandfather, and D is B's grandmother, X and Y is married. Hmm also, if E is X's brother, E is A and B's uncle.

It's a complicated coding. I found a full source code about that problem. But I've lost right now :(

So, can I find any example that similar to what I want ? Also, where can I find understandable prolog source codes to study ?

Thanks a lot for the replies :)
 
its not complicated at all.
describe all your people as male(name) or female(name) and one basic relationship f.ex. father/mother.
from there on create predicates such as
a)parent(X,Y):-father(X,Y).
parent(X,Y):-mother(X,Y).

b)brother(X,Y):parent(Z,X),parent(Z,Y),male(X).
[Z is parent both to X and Y and X is male]

then you can start building your way up [grandfather=father of father] or sideways[uncle=brother of father].

its not that big a deal!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top