Hello,
I am using ancient Turbo Prolog since it is included in our curriculum. Why is this program not working?
domains
disease, indication = symbol
Patient = string
Fe,Ra,He,Ch,Vo,Ru = char
predicates
hypothesis(Patient,disease)
symptom(Patient,indication,char)
response(char)
go
clauses
go:-
write("What is patient's name?"),
readln(Patient),
symptom(Patient,fever,Fe),
symptom(Patient,rash,Ra),
symptom(Patient,head_ache,He),
symptom(Patient,chills,Ch),
symptom(Patient,runny_nose,Ru),
symptom(Patient,head_ache,He),
symptom(Patient,vomit,Vo),
hypothesis(Patient,Disease),
write(Patient," probably has ", Disease , "."),nl.
go:-
write("Sorry unable to seem to be diagnose disease"),nl.
symptom(Patient,Fever,Feedback) :-
Write("Does " , Patient , " have " , Fever , "(y/n) ?"),
response(Reply),
Feedback = Reply.
hypothesis(Patient, chicken_pox) :-
Fe = Ra = He = Ch = 'y'.
hypothesis(Patient, caner) :-
Ru = Ra = He = Vo = 'y'.
hypothesis(Patient, measles) :-
Vo = Ra = Ch = Fe = He = 'y'.
response(Reply):-
readchar(Reply),
write(Reply),nl.
I get the warning variable is only used at all lines which contains symtoms
. Isn't the parameter passing call by reference? When i pass Fe
to symptoms
the value should be copied to Fe
and when i compare it in hypothesis it should work accordingly. =
operator in Turbo Prolog works very strangely. When it is not bound to any variable, the statement a = 3
will assign 3 to a and when a already contains a value a = 5
will check whether a's value is 5 or not.
Kindly help me why is the program not working?
Thanks in advance :)