Compare commits
2 Commits
b02bbb36cc
...
fc7a6313ce
Author | SHA1 | Date | |
---|---|---|---|
|
fc7a6313ce | ||
|
368c765c92 |
15
06_prolog/desc
Normal file
15
06_prolog/desc
Normal file
@ -0,0 +1,15 @@
|
||||
Knowledge base is in the file kb1.txt.
|
||||
|
||||
1. Convert the file 'family-tree.txt' to Prolog Facts (format understandable for Prolog) in any language you like.
|
||||
|
||||
The file has 4 columns: name, surname, pesel, parent's pesel
|
||||
|
||||
2. Prepare the script, load it to Prolog and find out who are the parents of:
|
||||
|
||||
Haley, Vargas, 1268649062, 1897283424
|
||||
|
||||
3. Check if the Darwin laws are in place by checking if Haley Vargas is the ancestor of an ape.
|
||||
|
||||
4. Write in any language (in any other programming paradigm except the logic programming languages), a code which will do the same as here in Prolog. Choose the programming language wisely.
|
||||
|
||||
5. Check if the creationist theory is correct by checking if all people come from apes.
|
33
06_prolog/ex1.pl
Normal file
33
06_prolog/ex1.pl
Normal file
@ -0,0 +1,33 @@
|
||||
:- discontiguous male/1, female/1, parent/2.
|
||||
male(dicky).
|
||||
male(randy).
|
||||
male(mike).
|
||||
male(don).
|
||||
male(elmer).
|
||||
female(anne).
|
||||
female(rosie).
|
||||
female(esther).
|
||||
female(mildred).
|
||||
female(greatgramma).
|
||||
male(blair).
|
||||
|
||||
parent(don,randy).
|
||||
parent(don,mike).
|
||||
parent(don,anne).
|
||||
parent(rosie,randy).
|
||||
parent(rosie,mike).
|
||||
parent(rosie,anne).
|
||||
parent(elmer,don).
|
||||
parent(mildred,don).
|
||||
parent(esther,rosie).
|
||||
parent(esther,dicky).
|
||||
parent(greatgramma,esther).
|
||||
parent(randy,blair).
|
||||
|
||||
male(mel).
|
||||
male(teo).
|
||||
parent(melsr,mel).
|
||||
parent(melsr,teo).
|
||||
|
||||
father(X,Y) :- male(X),parent(X,Y).
|
||||
mother(X,Y) :- female(X),parent(X,Y).
|
10
06_prolog/fac.pl
Normal file
10
06_prolog/fac.pl
Normal file
@ -0,0 +1,10 @@
|
||||
fac(0,1).
|
||||
fac(1,1).
|
||||
fac(2,2).
|
||||
fac(3,6).
|
||||
fac(4,24).
|
||||
fac(A,B) :-
|
||||
A > 0,
|
||||
fac(C,D),
|
||||
C is A-1,
|
||||
B is A*D.
|
377251
06_prolog/family-tree.txt
Normal file
377251
06_prolog/family-tree.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user