2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pref(P,X) :-
|
|
|
|
nb_current(P,_),
|
|
|
|
nb_getval(P,Y),
|
2019-05-27 23:40:48 +02:00
|
|
|
!,
|
2019-05-27 22:58:09 +02:00
|
|
|
( Y = X
|
2019-05-27 23:40:48 +02:00
|
|
|
; ( Y = nie(Z), Z \= X)
|
|
|
|
; Y = cokolwiek).
|
2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
pref(P,X) :-
|
|
|
|
format("~w:\n", [P]),
|
|
|
|
read(Y),
|
|
|
|
nb_setval(P,Y),
|
|
|
|
( Y = X
|
2019-05-27 23:40:48 +02:00
|
|
|
; ( Y = nie(Z), Z \= X)
|
|
|
|
; Y = cokolwiek).
|
|
|
|
|
|
|
|
prefb(P,X) :-
|
|
|
|
nb_current(P,_),
|
|
|
|
nb_getval(P,Y),
|
|
|
|
!,
|
|
|
|
Y=X.
|
2019-05-27 22:58:09 +02:00
|
|
|
|
2019-05-27 23:40:48 +02:00
|
|
|
prefb(P,X) :-
|
|
|
|
format("~w?\n",[P]),
|
|
|
|
read(Y),
|
|
|
|
nb_setval(P,Y),
|
|
|
|
Y = X.
|
2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
termin(XS) :-
|
|
|
|
nb_current(termin,_),
|
|
|
|
nb_getval(termin,Y),
|
2019-05-27 23:40:48 +02:00
|
|
|
!,
|
2019-05-27 22:58:09 +02:00
|
|
|
member(X,XS),
|
|
|
|
( (Y1-Y2 = Y, X >= Y1, X =< Y2)
|
|
|
|
; (nie(Y1-Y2) = Y, (X < Y1 ; X > Y2))
|
|
|
|
),
|
|
|
|
!.
|
|
|
|
|
|
|
|
termin(XS) :-
|
|
|
|
format("termin (od-do):\n"),
|
|
|
|
read(Y),
|
|
|
|
nb_setval(termin,Y),
|
|
|
|
member(X,XS),
|
|
|
|
( (Y1-Y2 = Y, X >= Y1, X =< Y2)
|
|
|
|
; (nie(Y1-Y2) = Y, (X < Y1 ; X > Y2))
|
|
|
|
),
|
|
|
|
!.
|
|
|
|
|
|
|
|
|
|
|
|
cena(X) :-
|
|
|
|
nb_current(cena,_),
|
|
|
|
nb_getval(cena,Y),
|
2019-05-27 23:40:48 +02:00
|
|
|
!,
|
2019-05-27 22:58:09 +02:00
|
|
|
X=<Y.
|
|
|
|
|
|
|
|
cena(X) :-
|
|
|
|
format("maksymalna cena:\n"),
|
|
|
|
read(Y),
|
|
|
|
nb_setval(cena, Y),
|
|
|
|
X =< Y.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wakacje(zakopane) :-
|
|
|
|
pref(kraj,polska),
|
|
|
|
pref(teren,gory),
|
2019-05-27 23:40:48 +02:00
|
|
|
cena(3000).
|
2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
wakacje(hawaje) :-
|
|
|
|
termin([6,7,8]),
|
|
|
|
pref(kraj, usa),
|
|
|
|
pref(teren, morze),
|
|
|
|
cena(8000).
|
|
|
|
|
2019-05-27 23:40:48 +02:00
|
|
|
wakacje(hawaje_poza_sezonem) :-
|
|
|
|
termin([1,2,3,4,5,9,10,11,12]),
|
|
|
|
pref(kraj, usa),
|
|
|
|
pref(teren, morze),
|
|
|
|
cena(5000).
|
|
|
|
|
|
|
|
wakacje(himalaje) :-
|
|
|
|
termin([1,2,3,10,11,12]),
|
|
|
|
cena(5000),
|
|
|
|
pref(teren, gory),
|
|
|
|
prefb(dzieci, nie).
|
2019-05-27 22:58:09 +02:00
|
|
|
|
2019-05-27 23:40:48 +02:00
|
|
|
wakacje(hel) :-
|
|
|
|
termin([5,6,7,8]),
|
|
|
|
pref(teren, morze),
|
|
|
|
pref(kraj, polska),
|
|
|
|
cena(2000).
|
2019-05-27 22:58:09 +02:00
|
|
|
|
2019-05-27 23:40:48 +02:00
|
|
|
wakacje(mazury) :-
|
|
|
|
termin([4,5,6,7]),
|
|
|
|
pref(teren, jezioro),
|
|
|
|
pref(kraj, polska),
|
|
|
|
cena(1500).
|
|
|
|
|
|
|
|
wakacje(bieszczady) :-
|
|
|
|
pref(teren, gory),
|
|
|
|
pref(kraj, polska),
|
|
|
|
cena(2000).
|
2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clear :-
|
2019-05-27 23:40:48 +02:00
|
|
|
forall(member(A, [kraj,teren, termin, cena, dzieci]), nb_delete(A)).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
wakacje2(X) :-
|
2019-05-27 23:40:48 +02:00
|
|
|
( findall(Y,wakacje(Y),X), clear) ; (clear , fail).
|
2019-05-27 22:58:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|