カリキュラムに含まれているので、私は古代のターボプロローグを使用しています。このプログラムが機能しないのはなぜですか?
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.
警告変数は、を含むすべての行でのみ使用されますsymtoms
。パラメータは参照によって呼び出しを渡しませんか?に渡すFe
とsymptoms
、値がコピーされFe
、仮説で比較すると、それに応じて機能するはずです。=
TurboPrologの演算子は非常に奇妙に機能します。変数にバインドされていない場合、ステートメントa = 3
はaに3を割り当て、すでに値が含まれている場合a = 5
は、aの値が5であるかどうかを確認します。
プログラムが機能しない理由を教えてください。
前もって感謝します :)