人工智能导论prolog编程题目
随便从网上找的一个family tree------------------------------------------------------------------------------------------------------%?Family?Membersmale(tom).male(john).male(adam).male(nike).male(bob).female(alisa).female(abby).female(anne).female(alice).female(betty).female(carry).female(chris).mother(alisa,?alice).mother(alisa,?anne).mother(alice,?carry).mother(abby,?adam).mother(abby,?betty).mother(betty,?chris).mother(betty,?bob).father(tom,?anne).father(tom,?alice).father(john,?adam).father(john,?betty).father(nike,?chris).father(nike,?bob).father(adam,?carry).%%%%%%%%%%%%%%%%%%%%%%%?Parent:?a?father?or?motherparent(A,?B):-father(A,?B);mother(A,?B)%?Child:?a?human?offspring?(son?or?daughter)?of?any?agechild(A,?B):-parent(B,?A).%?Daughter:?a?female?human?offspringdaughter(A,?B):-female(A),child(A,?B).%?Son:?a?male?human?offspringson(A,?B):-male(A),child(A,?B).%?Sibling:?a?persons?brother?or?sistersibling(A,?B):-parent(C,?A),parent(C,?B),A?\=?B.%?Sister:?a?female?person?who?has?the?same?parents%?as?another?personsister(A,?B):-sibling(A,?B),female(A).%?Brother:?a?male?with?the?same?parents?as?someone?elsebrother(A,?B):-sibling(A,?B),male(A).%%%%%%%%%%%%%%%%%%%%%%%%%?Aunt:?the?sister?of?your?father?or?motheraunt(A,?B):-parent(C,?B),sister(A,?C).%?Uncle:?the?brother?of?your?father?or?motheruncle(A,?B):-parent(C,?B),brother(A,?C).%?Cousin:?the?child?of?your?aunt?or?unclecousin(A,?B):-parent(C,?B),sibling(D,?C),child(A,?D).%%%%%%%%%%%%%%%%%%%%%%%%%?Grandparent:?a?parent?of?your?father?or?mothergrandparent(A,?B):-parent(A,?C),parent(C,?B).%?Grandfather:?the?father?of?your?father?or?mothergrandfather(A,?B):-male(A),grandparent(A,?B).%?Grandmother:?the?mother?of?your?father?or?mothergrandmother(A,?B):-female(A),grandparent(A,?B).%?Grandchild:?a?child?of?your?son?or?daughtergrandchild(A,?B):-grandparent(B,?A).%?Grandson:?a?male?grandchildgrandson(A,?B):-male(A),grandchild(A,?B).%?Granddaughter:?a?female?grandchildgrandson(A,?B):-female(A),grandchild(A,?B).------------------------------------------------------