Compare commits

...

2 Commits

Author SHA1 Message Date
Arkadiusz Hypki
fc7a6313ce Merge branch 'master' of https://git.wmi.amu.edu.pl/ahypki/wmi-parprog 2024-04-15 13:41:11 +02:00
Arkadiusz Hypki
368c765c92 '06_Prolog;' 2024-04-15 13:40:54 +02:00
4 changed files with 377309 additions and 0 deletions

15
06_prolog/desc Normal file
View 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
View 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
View 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

File diff suppressed because it is too large Load Diff