Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % ema predikaadi näide: mother(laps, ema)
- % kui panna nimesid kirja suure tähega, siis peab kasutama jutumärke, muidu on tegemist muutujaga
- male(jyri).
- male(jyrgo).
- male(jyrgen).
- female(piret).
- female(tiiu).
- female(tiia).
- married(tiia, jyri).
- mother(jyrgo, tiia).
- mother(jyrgen, tiia).
- mother(piret, tiia).
- mother(tiiu, tiia).
- ema_lapsed(Mina):-
- mother(Mina,Ema),
- mother(Teine_laps,Ema),
- Teine_laps \= Mina,
- write (Teine_laps), nl,
- fail.
- ema_lapsed(_):- write('minu emal ei ole rohkem lapsi').
- father(Mina, Isa):-
- mother(Mina, Ema),
- married(Ema, Kes),
- male(Kes),
- Isa = Kes.
- brother(Mina, Vend):-
- mother(Mina, Ema),
- mother(Teine_laps, Ema),
- Teine_laps \= Mina,
- male(Teine_laps),
- Vend = Teine_laps.
- sister(Mina, Ode):-
- mother(Mina, Ema),
- mother(Teine_laps, Ema),
- Teine_laps \= Mina,
- female(Teine_laps),
- Ode = Teine_laps.
- aunt(Mina, Tadi):-
- mother(Mina, Ema),
- father(Mina, Isa),
- (sister(Ema, Tundmatu) ; sister(Isa, Tundmatu)),
- Tadi = Tundmatu.
- uncle(Mina, Onu):-
- mother(Mina, Ema),
- father(Mina, Isa),
- (brother(Ema, Tundmatu) ; brother(Isa, Tundmatu)),
- Onu = Tundmatu.
- grandfather(Mina, Vanaisa):-
- mother(Mina, Ema),
- father(Mina, Isa),
- (father(Isa, Tundmatu) ; father(Ema, Tundmatu)),
- Vanaisa = Tundmatu.
- grandmother(Mina, Vanaema):-
- mother(Mina, Ema),
- father(Mina, Isa),
- (mother(Ema, Tundmatu) ; mother(Isa, Tundmatu)),
- Vanaema = Tundmatu.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement