-
-
Save jazibobs/6569e628548a427090752d9b31f82c04 to your computer and use it in GitHub Desktop.
Expert System - Mr. Rigby family tree expert system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Our knowledge base */ | |
parent(jeff, jared). | |
parent(jeff, adam). | |
parent(diane, jared). | |
parent(diane, adam). | |
parent(george, diane). | |
parent(doris, diane). | |
parent(gerald, jeff). | |
parent(june, jeff). | |
parent(gerald, jill). | |
parent(june, jill). | |
parent(jill, aaron). | |
parent(jill, ireyna). | |
parent(jill, jason). | |
parent(paul, aaron). | |
parent(paul, ireyna). | |
parent(paul, jason). | |
parent(adam, jessica). | |
parent(frankie, jessica). | |
/* Our rules base */ | |
grandparent(G, C) :- | |
parent(G, P), | |
parent(P, C). | |
sibling(A, B) :- | |
parent(P, A), | |
parent(P, B), | |
not(A=B). | |
cousin(A, B) :- | |
grandparent(G, A), | |
grandparent(G, B), | |
not(sibling(A, B)), | |
not(A=B). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment