Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.2 kB
1
Indexable
Never
/* my family */

parent(rustam,danish).
parent(rustam,usman).
parent(rustam,fahad).
parent(rustam,mubeen).
parent(rustam,hina).
parent(rustam,faiza).


parent(khalida,danish).
parent(khalida,usman).
parent(khalida,fahad).
parent(khalida,mubeen).
parent(khalida,hina).
parent(khalida,faiza).

/*my family ended */

/*grand father family */

parent(atta,rustam).
parent(atta,noor).
parent(atta,hussain).


parent(amna,rustam).
parent(amna,noor).
parent(amna,hussain).

/*grand father family ended */

/*grandpa family */

parent(abdulrehman,khalida).
parent(abdulrehman,rafiq).
parent(abdulrehman,yusuf).


parent(halima,khalida).
parent(halima,rafiq).
parent(halima,yusuf).

/*grandpa family ended */

/* mother's brother family*/
parent(rafiq,khadija).
parent(rafiq,hafeez).
parent(rafiq,anila).


male(rustam).
male(danish).
male(usman).
male(fahad).
male(mubeen).
male(atta).
male(noor).
male(hussain).
male(abdulrehman).
male(rafiq).
male(yusuf).

female(khalida).
female(hina).
female(faiza).
female(halima).
female(amna).




mother(X,Y):-
    parent(X,Y),
    female(X).
    
father(X,Y):-
    parent(X,Y),
    male(X).

brother(X,Y):-
    sibling(X,Y),
    male(X),
    X \= Y.

sister(X,Y):-
    sibling(X,Y),
    female(X),
    X \= Y.


grandfather(X,Y):-
    parent(Z,Y), /* Z is the parent of Y */
    parent(X,Z), /* X is the parent of Z */
    male(X).

grandmother(X,Y):-
    parent(Z,Y), /* Z is the parent of Y */
    parent(X,Z), /* X is the parent of Z */
    female(X).


son(X,Y):-
    parent(Y,X), /* Y is the son of X */
    male(X).

daughter(X,Y):-
    parent(Y,X), /* Y is the daughter of X */
    female(X).


sibling(X,Y):-
    father(Z,Y),
    father(Z,X),
    X \= Y.


cousin(X,Y):- 
    parent(Z,X),
    parent(W,Y),
    sibling(Z,W),
	X \= Y.
/* agr parent aik dosre k sibling hogai
    			tu X aur Y apas main cousin hain*/


uncle(X,Y):-
    parent(Z,Y),
    brother(Z,X).


aunty(X,Y):-
    parent(Z,Y),
    sister(X,Z).

nephew(X,Y):-
    parent(Z,X),
    sibling(Y,Z),
    male(X). 

niece(X,Y):-
    parent(Z,X),
    sibling(Y,Z),
    female(X).