SlideShare a Scribd company logo
1 of 3
Download to read offline
can someone fix this prolog code that does not display the female siblings?
%gender of all the people
gender(male,[abraham, isaac, jacob,judah, reuben, simeon, levi, dan, naphtali, gad, asher,
issachar, zebulun, joseph, benjamin, perez, zerah, hezron, ram,amminadab,nahshon,
salmon,
boaz, obed, jesse, david, solomon, rehoboam, abijah, asa, jehoshaphat, jehoram,
uzziah,jotham,ahaz,
hezehiah, manasseh, amon,
josiah,jeconiah,shealtiel,zerubbabel,abihud,eliakim,azor,zadok,akim,
elihud, eleazar,matthan,jacob,joseph,jesus]).
gender(female,[dinah,tamar,rahab,ruth,bathsheeba,mary]).
%father facts
father(abraham, isaac).
father(isaac, jacob).
father(jacob, judah).
father(jacob, reuben).
father(jacob, simeon).
father(jacob, levi).
father(jacob, dan).
father(jacob, naphtali).
father(jacob, gad).
father(jacob, asher).
father(jacob, issachar).
father(jacob, zebulun).
father(jacob, dinah).
father(jacob, joseph).
father(jacob, benjamin).
father(judah, perez).
father(judah, zerah).
father(perez, hezron).
father(herzon, ram).
father(ram, amminadab).
father(amminadab, nahshon).
father(nahshon, salmon).
father(salmon, boaz).
father(boaz, obed).
father(obed, jesse).
father(jesse, david).
father(david, solomon).
father(solomon, rehoboam).
father(rehoboam, abijah).
father(abijah, asa).
father(asa, jehoshaphat).
father(jehoshaphat, jehoram).
father(jehoram, uzziah).
father(uzziah, jotham).
father(jotham, ahaz).
father(ahaz, hezekiah).
father(hezekiah, manasseh).
father(manasseh, amon).
father(amon, josiah).
father(josiah, jeconiah).
father(jeconiah, shealtiel).
father(shealtiel, zerubbabel).
father(zerubbabel, abihud).
father(abihud, eliakim).
father(eliakim, azor).
father(azor, zadok).
father(zadok, akim).
father(akim, elihud).
father(elihud, eleazar).
father(eleazar, matthan).
father(matthan, jacobNew).%New for new Testement - fixes duplicates
father(jacobNew, josephNew).
father(josephNew, jesus).
%mother facts
mother(tamar, zerah).
mother(tamar, perez).
mother(rahab, boaz).
mother(ruth, obed).
mother(bathsheeba, solomon).
mother(mary, jesus).
%Siblings
siblings(judah,[judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, dinah,
joseph, benjamin,]).
siblings(perez,[perez,zerah]).
%rules relations
son(X, Y) :- father(Y, X).
son(X,Y):-mother(Y,X).
%queries
displaysiblings:- format("The sibling pairs are:n"),forall(siblings(_,Y),writeln(Y)).%displays
the sibling pairs.
displaymales:- X = male,format("The males are:n"),forall(gender(X,Y),writeln(Y)).%displays
all males.
displayfemales:- Y = female,format("The females
are:n"),forall(gender(Y,X),writeln(X)).%displays all females.
findfather(X):-father(Y,X),format("~w is the father of ~w.",[Y,X]).%finds the father of a certain
male.
findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]).%finds the son
of a certain male if they have siblings.
findson(X):-father(X,Y), format("~w is the son of ~w",[Y,X]).%finds the son of a certain male
if they dont have siblings.
findgfather(X):- father(Y, Z), father(Z, X),format('~w is the grandfather of ~w',[Y,X]).%finds
the grandfather of certain male.
findmother(X):-mother(Y,X),format("~w is the mother of ~w.",[Y,X]).%finds the mother of a
certain male.

More Related Content

More from info189835

California condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdfCalifornia condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdfinfo189835
 
California continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdfCalifornia continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdfinfo189835
 
Calculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdfCalculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdfinfo189835
 
calculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdfcalculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdfinfo189835
 
Calculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdfCalculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdfinfo189835
 
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdfCalculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdfinfo189835
 
Calculate the of total (portfolio weight) for eachStock A pr.pdf
Calculate the  of total (portfolio weight) for eachStock A pr.pdfCalculate the  of total (portfolio weight) for eachStock A pr.pdf
Calculate the of total (portfolio weight) for eachStock A pr.pdfinfo189835
 
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdfCalculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdfinfo189835
 
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdfCada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdfinfo189835
 
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdfCada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdfinfo189835
 
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdfC coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdfinfo189835
 
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfC++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfinfo189835
 
C++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdfC++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdfinfo189835
 
C++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdfC++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdfinfo189835
 
C++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdfC++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdfinfo189835
 
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdfC(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdfinfo189835
 
By answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdfBy answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdfinfo189835
 
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdfBUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdfinfo189835
 
C programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdfC programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdfinfo189835
 
C programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdfC programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdfinfo189835
 

More from info189835 (20)

California condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdfCalifornia condors (Gymnogyps californianus) are listed on the IUCN .pdf
California condors (Gymnogyps californianus) are listed on the IUCN .pdf
 
California continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdfCalifornia continues to face a water shortage. The quantity of water.pdf
California continues to face a water shortage. The quantity of water.pdf
 
Calculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdfCalculate the various ratios based on the following informationCa.pdf
Calculate the various ratios based on the following informationCa.pdf
 
calculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdfcalculate the return on assets calculate the return on equity ca.pdf
calculate the return on assets calculate the return on equity ca.pdf
 
Calculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdfCalculate the frequency of alleles A and B for the two populations s.pdf
Calculate the frequency of alleles A and B for the two populations s.pdf
 
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdfCalculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
Calculate the Earnings Per Share (EPS) and Dividends Per Share (DPS).pdf
 
Calculate the of total (portfolio weight) for eachStock A pr.pdf
Calculate the  of total (portfolio weight) for eachStock A pr.pdfCalculate the  of total (portfolio weight) for eachStock A pr.pdf
Calculate the of total (portfolio weight) for eachStock A pr.pdf
 
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdfCalculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
Calculate R2. (Round your answer to 4 decimal places.)Moviegoer Sp.pdf
 
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdfCada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
Cada vez es m�s dif�cil mantenerse al d�a con los problemas tecnol�g.pdf
 
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdfCada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
Cada una de las siguientes cuentas se reporta como pasivo a largo pl.pdf
 
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdfC coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
C coding into MIPS coding (Make sure this code works on Qtmips) Ho.pdf
 
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfC++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
 
C++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdfC++ help finish my code Topics class definitions, arrays of objec.pdf
C++ help finish my code Topics class definitions, arrays of objec.pdf
 
C++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdfC++ help !!!!Sally wants to write a program to help with her kee.pdf
C++ help !!!!Sally wants to write a program to help with her kee.pdf
 
C++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdfC++ 10.14 LAB Book information (overriding member functions)Given.pdf
C++ 10.14 LAB Book information (overriding member functions)Given.pdf
 
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdfC(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
C(x)=10x+3000 represents cost to produce x number of items. How many i.pdf
 
By answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdfBy answering the following question with references1. Which p.pdf
By answering the following question with references1. Which p.pdf
 
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdfBUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
BUSINESSTECHNOLOGYHEALTH SCIENCES COURSES HO.pdf
 
C programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdfC programming languageHello i currently have this code and it is s.pdf
C programming languageHello i currently have this code and it is s.pdf
 
C programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdfC programming languageHello i am hoping to get some help understa.pdf
C programming languageHello i am hoping to get some help understa.pdf
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

Fix prolog code to display female siblings

  • 1. can someone fix this prolog code that does not display the female siblings? %gender of all the people gender(male,[abraham, isaac, jacob,judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, joseph, benjamin, perez, zerah, hezron, ram,amminadab,nahshon, salmon, boaz, obed, jesse, david, solomon, rehoboam, abijah, asa, jehoshaphat, jehoram, uzziah,jotham,ahaz, hezehiah, manasseh, amon, josiah,jeconiah,shealtiel,zerubbabel,abihud,eliakim,azor,zadok,akim, elihud, eleazar,matthan,jacob,joseph,jesus]). gender(female,[dinah,tamar,rahab,ruth,bathsheeba,mary]). %father facts father(abraham, isaac). father(isaac, jacob). father(jacob, judah). father(jacob, reuben). father(jacob, simeon). father(jacob, levi). father(jacob, dan). father(jacob, naphtali). father(jacob, gad). father(jacob, asher). father(jacob, issachar). father(jacob, zebulun). father(jacob, dinah). father(jacob, joseph). father(jacob, benjamin). father(judah, perez). father(judah, zerah). father(perez, hezron). father(herzon, ram). father(ram, amminadab). father(amminadab, nahshon). father(nahshon, salmon). father(salmon, boaz).
  • 2. father(boaz, obed). father(obed, jesse). father(jesse, david). father(david, solomon). father(solomon, rehoboam). father(rehoboam, abijah). father(abijah, asa). father(asa, jehoshaphat). father(jehoshaphat, jehoram). father(jehoram, uzziah). father(uzziah, jotham). father(jotham, ahaz). father(ahaz, hezekiah). father(hezekiah, manasseh). father(manasseh, amon). father(amon, josiah). father(josiah, jeconiah). father(jeconiah, shealtiel). father(shealtiel, zerubbabel). father(zerubbabel, abihud). father(abihud, eliakim). father(eliakim, azor). father(azor, zadok). father(zadok, akim). father(akim, elihud). father(elihud, eleazar). father(eleazar, matthan). father(matthan, jacobNew).%New for new Testement - fixes duplicates father(jacobNew, josephNew). father(josephNew, jesus). %mother facts mother(tamar, zerah). mother(tamar, perez). mother(rahab, boaz). mother(ruth, obed). mother(bathsheeba, solomon).
  • 3. mother(mary, jesus). %Siblings siblings(judah,[judah, reuben, simeon, levi, dan, naphtali, gad, asher, issachar, zebulun, dinah, joseph, benjamin,]). siblings(perez,[perez,zerah]). %rules relations son(X, Y) :- father(Y, X). son(X,Y):-mother(Y,X). %queries displaysiblings:- format("The sibling pairs are:n"),forall(siblings(_,Y),writeln(Y)).%displays the sibling pairs. displaymales:- X = male,format("The males are:n"),forall(gender(X,Y),writeln(Y)).%displays all males. displayfemales:- Y = female,format("The females are:n"),forall(gender(Y,X),writeln(X)).%displays all females. findfather(X):-father(Y,X),format("~w is the father of ~w.",[Y,X]).%finds the father of a certain male. findson(X):-father(X,Y), siblings(Y,Z), format("~w are the sons of ~w",[Z,X]).%finds the son of a certain male if they have siblings. findson(X):-father(X,Y), format("~w is the son of ~w",[Y,X]).%finds the son of a certain male if they dont have siblings. findgfather(X):- father(Y, Z), father(Z, X),format('~w is the grandfather of ~w',[Y,X]).%finds the grandfather of certain male. findmother(X):-mother(Y,X),format("~w is the mother of ~w.",[Y,X]).%finds the mother of a certain male.