Compare commits
4 Commits
8a088468bd
...
207bf9c14c
Author | SHA1 | Date | |
---|---|---|---|
|
207bf9c14c | ||
|
92f695e60c | ||
|
028724325d | ||
|
1f5ba69a6d |
@ -23,6 +23,7 @@ parent(esther,rosie).
|
||||
parent(esther,dicky).
|
||||
parent(greatgramma,esther).
|
||||
parent(randy,blair).
|
||||
parent(mike,juliet).
|
||||
|
||||
male(mel).
|
||||
male(teo).
|
||||
@ -31,3 +32,18 @@ parent(melsr,teo).
|
||||
|
||||
father(X,Y) :- male(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).
|
BIN
06_prolog/ex2-roads/Siec_drog_kraj_10_02_23.pdf
Normal file
BIN
06_prolog/ex2-roads/Siec_drog_kraj_10_02_23.pdf
Normal file
Binary file not shown.
BIN
06_prolog/ex2-roads/Zarzadzenie_GD_nr_32_z_dnia_2022-12-27.pdf
Normal file
BIN
06_prolog/ex2-roads/Zarzadzenie_GD_nr_32_z_dnia_2022-12-27.pdf
Normal file
Binary file not shown.
5
06_prolog/ex2-roads/desc
Normal file
5
06_prolog/ex2-roads/desc
Normal file
@ -0,0 +1,5 @@
|
||||
Parse the file Zarzadzenie_GD_nr_32_z_dnia_2022-12-27.pdf by extracting the connections between the cities (e.g. copy&paste from pdf, pinch of regex, mix for a few minutes). Create facts for Prolog and do the exercises:
|
||||
|
||||
1. Find any path from Suwałki to Jelenia Góra
|
||||
|
||||
2. Find all paths between Szczecin and Przemyśl and find the shortest one
|
@ -5,6 +5,6 @@ fac(3,6).
|
||||
fac(4,24).
|
||||
fac(A,B) :-
|
||||
A > 0,
|
||||
fac(C,D),
|
||||
C is A-1,
|
||||
fac(C,D),
|
||||
B is A*D.
|
Loading…
Reference in New Issue
Block a user