Jump to content

I need help to solve Geneology problem, please?


Shuvro

Recommended Posts

given the following knowledge base for family relation:

female(shelley).

female(mary).

female(lisa).

female(joan).

mother(mary, jake).

mother(mary, shelley).

mother(lisa, mary).

mother(joan, bill).

father(bill, jake).

father(bill, shelley).

father(bob, mary).

father(frank, bill).

 

Write a predicate sibling/2 based on the knowledge given, will return the siblings based on the above knowledge. For example if you write sibling(child1, child2) then your program will return Child1 = jake

Child2 = Shelley. using prolog programming

Edited by Shuvro
need some correction
Link to comment
Share on other sites

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

  • Shuvro

    15

  • ReMark

    14

  • dbroada

    5

  • fabriciorby

    5

Top Posters In This Topic

Posted Images

Convert the following logic into AutoLISP code:

if (year is divisible by 4)
{
   if (year is divisible by 400)
   {
       return true
       else if (year is divisible by 100)
       {
           return false
           else return true
       }
   }
   else return false
}

Link to comment
Share on other sites

predicate sibling/2 based on the knowledge given, will return the siblings based on the above knowledge.

 

i cant understand those lines of the question.please solve this for me and make me smile again.....

Link to comment
Share on other sites

Maybe if you were to tell us the reason behind these questions we would have a better understanding of where this is all going. Your questions don't exactly seem to be related to CAD.

Link to comment
Share on other sites

i have started this way...may be its wrong,,i dont know.i think this is similar to my problem

 

female(X,Y) :- father(Z,X), father(Z,Y), not(X=Y). % 6

mother(X,Y) :- father(Z,X), father(W,Y), brother(Z,W). % 7

father(X,Y) :- father(Z,X), father(Y,Z). % 8

descendent(X,Y) :- father(Y,X). % 9

descendent(X,Y) :- father(Z,X), descendent(Z,Y). % 10

?- brother(X,Y).

X = b Y = c ;

X = c Y = b ;

X = d Y = e ;

X = e Y = d ;

No

 

?- cousin(X,Y).

X = d Y = f ;

X = e Y = f ;

X = f Y = d ;

X = f Y = e ;

No

 

?- grandson(X,Y).

X = d Y = a ;

X = e Y = a ;

X = f Y = a ;

No

 

?- descendent(X,Y).

X = b Y = a ;

X = c Y = a ;

X = d Y = b ;

X = e Y = b ;

X = f Y = c ;

X = d Y = a ;

X = e Y = a ;

X = f Y = a ;

No

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...