Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1.  
  2. notice:-
  3. write('System ekspertowy AI 2018'),nl.
  4.  
  5. /*HIPOTEZY*/
  6.  
  7. disease(Patient,zdolny):-
  8. symptom(Patient, dobra_krew),
  9. symptom(Patient, dobre_ekg),
  10. symptom(Patient, dobre_zeby),
  11. symptom(Patient, dobry_kregoslup).
  12.  
  13.  
  14. disease(Patient,niezdolny):-
  15. symptom(Patient, dobra_krew),
  16. symptom(Patient, zle_ekg),
  17. symptom(Patient, dobre_zeby),
  18. symptom(Patient, zle_zeby),
  19. symptom(Patient, zly_kregoslup).
  20.  
  21. disease(Patient,badania):-
  22. symptom(Patient, kontuzja),
  23. symptom(Patient, dobra_krew),
  24. symptom(Patient, dobre_ekg),
  25. symptom(Patient, dobre_zeby),
  26. symptom(Patient, niekregoslup).
  27.  
  28.  
  29.  
  30. /*REGULY*/
  31.  
  32. symptom(P, Val):-ask('Does the Patient have',Val).
  33. ask(Obj, Val):-known(Obj, Val, true),!.
  34. ask(Obj, Val):-known(Obj, Val, false),!, fail.
  35. ask(Obj, Val):-nl,write(Obj),write(' '),
  36. write( Val) , write('?(y/n)'), read(Ans), !,
  37. ((Ans=y, assert(known(Obj, Val, true)));(assert(known(Obj, Val, false)),fail)).
  38.  
  39. diagnose:-nl,write('Ocenianie zdolnosci...'),nl,disease(symptom,Disease) ,!,nl,
  40. write('Sportowiec jest: '), write(Disease).
  41. diagnose:- nl, write('Nie mozna okreslic!!').
  42.  
  43. start:-notice,repeat, abolish(known/3),dynamic(known/3), retractall(known/3), diagnose,nl,nl, write('Try again ? (y/n)'),read(Resp),\+ Resp=y,
  44. nl,write('Bye ! Thanks for using this system'),abolish(known,3) .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement