This repository contains Prolog code that represents the family tree of the Corleone family from the famous "The Godfather" series. The code includes facts about family members, their relationships, and various predicates to query and explore these relationships.
The Corleone Family Tree project in Prolog is designed to help users understand the complex relationships within the Corleone family. The family tree includes information about parents, children, siblings, and extended family members, as well as various predicates to determine specific familial relationships.
To run this Prolog code, you need to have SWI-Prolog installed on your machine. You can download and install it from the SWI-Prolog website.
-
Clone this repository to your local machine:
git clone https://github.com/joao-tinelli/corleone-family-tree.git cd corleone-family-tree
-
Open SWI-Prolog:
swipl
-
Load the family tree file:
?- [corleone_family_tree].
Once the Prolog file is loaded, you can use various predicates to query the family tree.
Here are some example queries you can run:
-
Find Parents:
?- parents(michael, Parents).
-
Find Children:
?- children(vito, Children).
-
Find Siblings:
?- list_siblings(michael, Siblings).
-
Find Gender:
?- male(michael).
-
Find Grandparents:
?- grandfather(Grandfather, anthony).
-
Find Cousins:
?- cousin(anthony, Cousins).
-
Find Uncles and Aunts:
?- uncle(Uncle, michael). ?- aunt(Aunt, michael).
-
Find Ancestors and Descendants:
?- ancestors(michael, Ancestors). ?- descendants(vito, Descendants).
-
General Relationship Query:
?- relationship(vito, michael).
The following predicates are available for querying the family tree:
parent(X, Y)
: X is the parent of Y.male(X)
: X is male.female(X)
: X is female.child(X, Y)
: X is the child of Y.daughter(X, Y)
: X is the daughter of Y.son(X, Y)
: X is the son of Y.children(X, Children)
: Children are the children of X.mother(X, Y)
: X is the mother of Y.father(X, Y)
: X is the father of Y.parents(X, Parents)
: Parents are the parents of X.sibling(X, Y)
: X and Y are siblings.list_siblings(X, Siblings)
: Siblings are the siblings of X.brother(X, Y)
: X is the brother of Y.sister(X, Y)
: X is the sister of Y.cousin(X, Y)
: X and Y are cousins.uncle(X, Y)
: X is the uncle of Y.aunt(X, Y)
: X is the aunt of Y.grandfather(X, Y)
: X is the grandfather of Y.grandmother(X, Y)
: X is the grandmother of Y.ancestor(X, Y)
: X is an ancestor of Y.ancestors(X, Ancestor_of)
: Ancestor_of are the ancestors of X.descendant(X, Y)
: X is a descendant of Y.descendants(X, Descendant_of)
: Descendant_of are the descendants of X.relationship(X, Y)
: Determines the relationship between X and Y.
Here are some example queries and their expected outputs:
-
Who are Michael's parents?
?- parents(michael, Parents). Parents = [vito, carmella].
-
Who are Vito's children?
?- children(vito, Children). Children = [michael, sonny, connie, fredo, tom].
-
Who are Michael's siblings?
?- list_siblings(michael, Siblings). Siblings = [sonny, connie, fredo, tom].
Contributions are welcome! Please fork the repository and create a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the Apache License. See the LICENSE file for details.