Shuvro Posted April 24, 2013 Share Posted April 24, 2013 (edited) 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 April 24, 2013 by Shuvro need some correction Quote Link to comment Share on other sites More sharing options...
pBe Posted April 24, 2013 Share Posted April 24, 2013 Is this a school assignment? Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 no this is not a school assignment.i have already tried it,,but it seems very difficult to me.. Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 Hi, I am facing problem again. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 24, 2013 Share Posted April 24, 2013 What kind of problem it is ? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 24, 2013 Share Posted April 24, 2013 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 } Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 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..... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 24, 2013 Share Posted April 24, 2013 Huh? This thread was about leap years a minute ago... Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 24, 2013 Share Posted April 24, 2013 It seems the OP has multiple posts requesting aid in solving logic(?) problems. Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 solve this problem plz,,i need this badly Quote Link to comment Share on other sites More sharing options...
troggarf Posted April 24, 2013 Share Posted April 24, 2013 its that time of year again Quote Link to comment Share on other sites More sharing options...
Tharwat Posted April 24, 2013 Share Posted April 24, 2013 its that time of year again ................ Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 24, 2013 Share Posted April 24, 2013 Please hurry. My boss requested this an hour ago. Quote Link to comment Share on other sites More sharing options...
troggarf Posted April 24, 2013 Share Posted April 24, 2013 I kinda feel bad for him... Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 hey guys..u there.please help me Quote Link to comment Share on other sites More sharing options...
ReMark Posted April 24, 2013 Share Posted April 24, 2013 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. Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 i wanna solve this problem for my satisfaction,,but i failed.Some coding problem occurred during this.so please help me to solve this Quote Link to comment Share on other sites More sharing options...
fabriciorby Posted April 24, 2013 Share Posted April 24, 2013 Show us your code (: Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 24, 2013 Share Posted April 24, 2013 You may post your attempt here and for sure someone will help you to debug it. Quote Link to comment Share on other sites More sharing options...
Shuvro Posted April 24, 2013 Author Share Posted April 24, 2013 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.