Points | 50 |
Deadline | Feb. 5 |
You must submit the following items:
I will use the following grading guidelines:
;;;====================================================== ;;; Family Tree ;;; ;;; Describes extended family relationships ;;; (sister, brother, grandparent, grandmother, grandfather, ;;; uncle, aunt, cousin, ancestor, in-law) ;;; ;;; ;;; ;;; ;;; CLIPS Version 6.0 Example ;;; ;;; To execute: Load, reset and run. ;;;====================================================== ;;;************* ;;;* TEMPLATES * ;;;************* (deftemplate father-of (slot father) (slot child)) (deftemplate mother-of (slot mother) (slot child)) (deftemplate wife-of (slot wife) (slot husband)) (deftemplate husband-of (slot husband) (slot wife)) (deftemplate male (slot person)) (deftemplate female (slot person)) ;;;***************** ;;;* INITIAL STATE * ;;;***************** (deffacts family (father-of (father "Franz Xaver") (child "Franz Anton")) (father-of (father "Franz Xaver") (child "Erwin")) (mother-of (mother "Josefine") (child "Franz Anton")) (mother-of (mother "Josefine") (child "Erwin")) (father-of (father "Franz Anton") (child "Franz Josef")) (father-of (father "Franz Anton") (child "Hubert")) (father-of (father "Franz Anton") (child "Bernhard")) (father-of (father "Franz Anton") (child "Heinrich")) (father-of (father "Franz Anton") (child "Irmgard")) (mother-of (mother "Margarethe") (child "Franz Josef")) (mother-of (mother "Margarethe") (child "Hubert")) (mother-of (mother "Margarethe") (child "Bernhard")) (mother-of (mother "Margarethe") (child "Heinrich")) (mother-of (mother "Margarethe") (child "Irmgard")) (wife-of (wife "Margarethe") (husband "Franz Anton")) (husband-of (husband "Franz Anton") (wife "Margarethe")) (wife-of (wife "Anna") (husband "Erwin")) (husband-of (husband "Erwin") (wife "Anna")) (male (person "Franz Anton")) (male (person "Erwin")) (male (person "Franz Josef")) (male (person "Hubert")) (male (person "Bernhard")) (male (person "Heinrich")) (female (person "Margarethe")) (female (person "Irmgard"))) ;;;****************** ;;;* RULES * ;;;****************** (defrule sister "same father, mother; female" (father-of (father ?fa) (child ?name1)) (father-of (father ?fa) (child ?name2&~?name1)) (mother-of (mother ?mom) (child ?name1)) (mother-of (mother ?mom) (child ?name2&~?name1)) (female (person ?name2)) => (printout t ?name2 " is the sister of " ?name1 crlf))