'FIxing fac.pl'

This commit is contained in:
Arkadiusz Hypki 2024-04-18 12:32:57 +02:00
parent 1f5ba69a6d
commit 028724325d
2 changed files with 16 additions and 1 deletions

View File

@ -32,3 +32,18 @@ parent(melsr,teo).
father(X,Y) :- male(X),parent(X,Y). father(X,Y) :- male(X),parent(X,Y).
mother(X,Y) :- female(X),parent(X,Y). mother(X,Y) :- female(X),parent(X,Y).
son(X,Y) :- male(X),parent(Y,X).
dauther(X,Y) :- female(X),parent(Y,X).
uncle(X,Y) :- male(X),brother(X,Z),parent(Z,Y).
aunt(X,Y) :- female(X),sister(X,Z),parent(Z,Y).
grandmother(X,Y) :- mother(Z,Y),mother(X,Z).
grandmother(X,Y) :- father(Z,Y),mother(X,Z).
grandmother(X,Y) :- female(X),parent(Z,Y),parent(X,Z).
%grandfather
sister(X,Y) :- female(X),parent(Z,X),parent(Z,Y),X\=Y.
brother(X,Y) :- male(X),parent(Z,X),parent(Z,Y),X\=Y.
cousin(X,Y) :- uncle(Z,Y),parent(Z,X).
cousin(X,Y) :- aunt(Z,Y),parent(Z,X).

View File

@ -5,6 +5,6 @@ fac(3,6).
fac(4,24). fac(4,24).
fac(A,B) :- fac(A,B) :-
A > 0, A > 0,
fac(C,D),
C is A-1, C is A-1,
fac(C,D),
B is A*D. B is A*D.