Skip to content
Snippets Groups Projects
Verified Commit 01cab113 authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Add part of family tree from season 1

parents
No related branches found
No related tags found
No related merge requests found
dark.pl 0 → 100644
/* The basic relations in the family tree are: parent(), male(), female().
With these three relations it's possible to define the whole 'tree'. */
female(hannah).
female(katharina).
female(martha).
female(jana).
male(jonas).
male(mikkel).
male(ulrich).
male(tronte).
male(mads).
male(magnus).
parent(mikkel, jonas).
parent(hannah, jonas).
parent(ulrich, mikkel).
parent(katharina, mikkel).
parent(ulrich, martha).
parent(katharina, martha).
parent(ulrich, magnus).
parent(katharina, magnus).
parent(jana, ulrich).
parent(tronte, ulrich).
parent(jana, mads).
parent(tronte, mads).
mother(M, C) :- parent(M, C), female(M).
father(F, C) :- parent(F, C), male(F).
child(C, P) :- parent(P, C).
daughter(D, P) :- child(D, P), female(D).
son(S, P) :- child(S, P), male(S).
sibling(A, B) :-
mother(M, A),
mother(M, B),
father(F, A),
father(F, B),
A \= B.
sister(Sister, Sibling) :- sibling(Sister, Sibling), female(Sister).
brother(B, S) :- sibling(B, S), male(B).
half_sibling(A, B) :-
A\=B,
mother(M, A),
mother(M, B).
half_sibling(A, B) :-
A\=B,
father(F, A),
father(F, B).
half_sister(Sister, Sibling) :- half_sibling(Sister, Sibling), female(Sister).
half_brother(B, S) :- half_sibling(B, S), male(B).
aunt(A, N) :- sibling(S, A), child(N, S), female(A).
uncle(U, N) :- sibling(S, U), child(N, S), male(U).
nephew(N, R) :- parent(P, N), sibling(P, R), male(N).
niece(N, R) :- parent(P, N), sibling(P, R), female(N).
grandparent(G, R) :- parent(G, P), parent(P, R).
grandchild(G, R) :- grandparent(R, G).
grandmother(G, R) :- grandparent(G, R), female(G).
grandfather(G, R) :- grandparent(G, R), male(G).
granddaughter(D, G) :- grandparent(G, D), female(D).
grandson(S, G) :- grandparent(G, S), male(S).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment