prolog.txt - Course CS 430 Fall 2004 Date Language Prolog...

This preview shows page 1 - 3 out of 6 pages.

/*Course: CS 430 Fall 2004Date: November 23, 2004Language: PrologCompiler: PDPrologEnvironmment: Windows XPSource Filename: family.proThis program is designed to answer questions about relationships withina given family tree. The program will tell you who the mother, father,sister, brother, aunt, uncle, grandmother, grandfather, brother in law,sister in law, mother in law, father in law, ancestor, and descendentof someone is. The standard form is predicate(someone, relation). where the relation will be the mother or father or so on.*/male(james1).male(charles1).male(charles2).male(james2).male(george1).male(paul).male(sam).female(catherine).female(elizabeth).female(sophia).female(claudia).female(fay)./* parent ( child, parent). */
parent(charles1, james1).parent(elizabeth, james1).parent(charles2, charles1).parent(catherine, charles1).parent(james2, charles1).parent(sophia, elizabeth).parent(george1, sophia).parent(george1, sam).parent(catherine, fay).parent(charles2, fay).parent(james2, fay).parent(sophia, paul).parent(elizabeth,claudia).parent(charles1, claudia)./* married ( A,B) - A is married to B */married ( james1, claudia).married( claudia, james1).married(charles1, fay).married(fay, charles1).married(elizabeth, paul).

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture