init
This commit is contained in:
commit
27d0d019ca
87
expert.pl
Normal file
87
expert.pl
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
|
||||
|
||||
pref(P,X) :-
|
||||
nb_current(P,_),
|
||||
nb_getval(P,Y),
|
||||
( Y = X
|
||||
; ( Y = nie(Z), Z \= X)),
|
||||
!.
|
||||
|
||||
pref(P,X) :-
|
||||
format("~w:\n", [P]),
|
||||
read(Y),
|
||||
nb_setval(P,Y),
|
||||
( Y = X
|
||||
; ( Y = nie(Z), Z \= X)).
|
||||
|
||||
|
||||
termin(XS) :-
|
||||
nb_current(termin,_),
|
||||
nb_getval(termin,Y),
|
||||
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),
|
||||
X=<Y.
|
||||
|
||||
cena(X) :-
|
||||
format("maksymalna cena:\n"),
|
||||
read(Y),
|
||||
nb_setval(cena, Y),
|
||||
X =< Y.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
wakacje(zakopane) :-
|
||||
|
||||
pref(kraj,polska),
|
||||
pref(teren,gory),
|
||||
cena(2000).
|
||||
|
||||
wakacje(hawaje) :-
|
||||
termin([6,7,8]),
|
||||
pref(kraj, usa),
|
||||
pref(teren, morze),
|
||||
cena(8000).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
clear :-
|
||||
forall(member(A, [kraj,teren, termin, cena]), nb_delete(A)).
|
||||
|
||||
wakacje2(X) :-
|
||||
( (wakacje(X), clear) ; (clear, fail)).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user