Skip to content

Instantly share code, notes, and snippets.

@vinothpandian
Created February 15, 2018 20:02
Show Gist options
  • Save vinothpandian/ceef8860f9c5bd29d305039e6aecfe3a to your computer and use it in GitHub Desktop.
Save vinothpandian/ceef8860f9c5bd29d305039e6aecfe3a to your computer and use it in GitHub Desktop.
person('Charles',1945,m).
person('Anne',1950,f).
person('Andrew',1960,m).
person('Edward',1964,m).
person('Diana',1961,f).
person('Camilla',1947,f).
person('William',1982,m).
person('Henry',1984,m).
person('Mark',1948,m).
person('Timothy',1950,m).
person('Sarah',1959,f).
person('Sophie',1965,f).
person('Peter',1977,m).
person('Zara',1981,f).
person('Louise',2003,f).
person('James',2007,m).
person('Beatrice',1988,f).
person('Eugenie',1990,f).
person('Catherine',1982,f).
person('Autumn',1978,f).
person('Savannah',2010,f).
person('George',2013,m).
person('Michael',1973,m).
person('Isla',2010,f).
person('Mancer',2017,m).
child('Philip','Elizabeth II','Charles').
child('Philip','Elizabeth II','Anne').
child('Philip','Elizabeth II','Andrew').
child('Philip','Elizabeth II','Edward').
child('Charles','Diana','William').
child('Charles','Diana','Henry').
child('Mark','Anne','Peter').
child('Mark','Anne','Zara').
child('Edward','Sophie','Louise').
child('Edward','Sophie','James').
child('Andrew','Sarah','Beatrice').
child('Andrew','Sarah','Eugenie').
child('Peter','Autumn','Savannah').
child('William','Kate','George').
child('Peter','Autumn','Isla').
child('Charles','Camilla','Mancer').
death('Diana',1997).
marriage('Philip','Elizabeth II',1947).
marriage('Mark','Anne',1973).
marriage('Timothy','Anne',1992).
marriage('Charles','Diana',1981).
marriage('Charles','Camilla',2005).
marriage('Andrew','Sarah',1986).
marriage('Edward','Sophie',1999).
marriage('William','Catherine',2011).
marriage('Michael','Zara',2011).
divorce('Mark','Anne',1992).
divorce('Charles','Diana',1996).
divorce('Andrew','Sarah',1996).
father(F,C):-child(F,_,C).
mother(M,C):-child(_,M,C).
parent(P,C):-father(P,C).
parent(P,C):-mother(P,C).
male(P):-person(P,_,m).
son(P,C):-parent(P,C),male(C).
halfbrother(HB,Person):-son(P,HB),father(P,Person),mother(M,Person), not mother(M,HB).
halfbrother(HB,Person):-son(P,HB),mother(P,Person),father(M,Person), not father(M,HB).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment