I'm new to prolog I'm trying to write a family tree I got the code to get parent,mother,father,sister,brother,etc.. I am trying to write code to get great-great-grandmother/s
I have this code to get great-grandmother/s :
great_grandmother(X,Y) :- parent(X,V), parent(V,W), parent(W,Y), female(X).
however I tried many times to get the great-great-grandmother/s but it is not working out. How would I modify my code to get the great-great-grandmother/s?
and also when I run my code on swish.swi I get all the correct great grandmothers but the program keeps running and it gives me false. Is there anyway to fix it based on my code to get great grandmothers?
; false.
is OK. - falseparent/2
. So far, we can only guess. But my guess is that you do not have sufficiently many persons. Otherwise how do you query great great grandmothers directly? It's all guesses, you need to provide more information. And simply ignore the; false.
- false