عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
  #1  
قديم 04-12-2009, 09:16 PM

M!ss Computer M!ss Computer غير متواجد حالياً

جامعي

 
تاريخ التسجيل: Dec 2009
التخصص: IS
نوع الدراسة: إنتظام
المستوى: السابع
الجنس: أنثى
المشاركات: 1
Skaau.com (10) مساعده في برنامج Polog


الي يعرف الرجاء انه يساعدني لو حتى يعطيني الفكرة الاساسية للحل:
السؤال كالاتي::
# draw the family tree corresponding to the follow prolog program:
Female(mary).
Female(Sandra).
Female(Juliet).
Female(lisa).
Male(peter).
Male(paul).
Male(dick).
Male(bob).
Male(harry).
Parent(bob,lisa).
Parent(bob,paul).
Parent(bob,mary).
Parent(Juliet,lisa).
Parent(Juliet,paul).
Parent(Juliet,mary).
Parent(peter,harry).
Parent(lisa,harry).
Parent(mary,dick).
Parent(mary,Sandra).
After having copied the given program ,define new predicates(in terms of rules using male/1.female/1 and parent /2)for the following family relations:
(a)father.
(b)sister.
(C) grandmother.
(d) cousin.
You may want to use the operator \=,which is the operatorof = .A goal like X \=Y succeeds , if the two terms X and Y cannot be matched.
Example:
X is the brother of y ,if they have a parent z in common and if x is male &if x & y don’t represent the same person . in prolog this can be expressed through the following rule:
Brother(x, y):
Parent (z, x).
Parent(z, y).
Male(X),
X \= Y.
تحيــــــــــــــــــــــــــــــــــــاتي لكمنقرتين لعرض الصورة في صفحة مستقلة
رد مع اقتباس