startmd:- medDiagnosis.
medDiagnosis:-
retractall(known(_,_,_)),
write('MEDICAL DIAGNOSTICS SYSTEM'),
write('\n------------------------------------------------------\n\n'),
write('Enter the patients name:'),
read(Patient),
hypothesis(Patient,Disease),
write('\n\n'),write(Patient),write('has'),write(Disease),nl.
medDiagnosis:-
write('\n\nCould not diagnose the disease\n\n').
hypothesis(Patient, disease_one):-
symptom(Patient,cough),
symptom(Patient,headache).
hypothesis(Patient,disease_two):-
symptom(Patient,fever),
symptom(Patient,headache).
hypothesis(Patient,disease_three):-
symptom(Patient,fever),
symptom(Patient,cough).
symptom(Patient,Symptom):-
known(y,Patient,Symptom),
!.
symptom(Patient,Symptom):-
known(_,Patient,Symptom),
!, fail.
symptom(Patient,Symptom):-
write('\n\tDoes '),write(Patient),write('has'),
write(Symptom),write(' ?(y/n) :' ),
read(Reply),
asserta(known(Reply,Patient,Symptom)),
Reply=y.
No comments:
Post a Comment