Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. % ema predikaadi näide: mother(laps, ema)
  2. % kui panna nimesid kirja suure tähega, siis peab kasutama jutumärke, muidu on tegemist muutujaga
  3.  
  4. male(jyri).
  5. male(jyrgo).
  6. male(jyrgen).
  7.  
  8. female(piret).
  9. female(tiiu).
  10. female(tiia).
  11.  
  12. married(tiia, jyri).
  13.  
  14. mother(jyrgo, tiia).
  15. mother(jyrgen, tiia).
  16. mother(piret, tiia).
  17. mother(tiiu, tiia).
  18.  
  19.  
  20. ema_lapsed(Mina):-
  21. mother(Mina,Ema),
  22. mother(Teine_laps,Ema),
  23. Teine_laps \= Mina,
  24. write (Teine_laps), nl,
  25. fail.
  26. ema_lapsed(_):- write('minu emal ei ole rohkem lapsi').
  27.  
  28. father(Mina, Isa):-
  29. mother(Mina, Ema),
  30. married(Ema, Kes),
  31. male(Kes),
  32. Isa = Kes.
  33.  
  34. brother(Mina, Vend):-
  35. mother(Mina, Ema),
  36. mother(Teine_laps, Ema),
  37. Teine_laps \= Mina,
  38. male(Teine_laps),
  39. Vend = Teine_laps.
  40.  
  41. sister(Mina, Ode):-
  42. mother(Mina, Ema),
  43. mother(Teine_laps, Ema),
  44. Teine_laps \= Mina,
  45. female(Teine_laps),
  46. Ode = Teine_laps.
  47.  
  48. aunt(Mina, Tadi):-
  49. mother(Mina, Ema),
  50. father(Mina, Isa),
  51. (sister(Ema, Tundmatu) ; sister(Isa, Tundmatu)),
  52. Tadi = Tundmatu.
  53.  
  54. uncle(Mina, Onu):-
  55. mother(Mina, Ema),
  56. father(Mina, Isa),
  57. (brother(Ema, Tundmatu) ; brother(Isa, Tundmatu)),
  58. Onu = Tundmatu.
  59.  
  60. grandfather(Mina, Vanaisa):-
  61. mother(Mina, Ema),
  62. father(Mina, Isa),
  63. (father(Isa, Tundmatu) ; father(Ema, Tundmatu)),
  64. Vanaisa = Tundmatu.
  65.  
  66. grandmother(Mina, Vanaema):-
  67. mother(Mina, Ema),
  68. father(Mina, Isa),
  69. (mother(Ema, Tundmatu) ; mother(Isa, Tundmatu)),
  70. Vanaema = Tundmatu.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement