나는 프롤로그 언어에 새로 온 사람과 내가 프롤로그에서 프로그램 할 필요가오류 [편집]
Rule 1:
if the environment is papers
or the environment is manuals
or the environment is documents
or the environment is textbooks
then stimulus_situation is verbal
Rule 2:
if the environment is pictures
if the environment is illustrations
if the environment is photographs
if the environment is diagrams
then stimulus_situation is visual
Rule 3:
if the environment is machines
if the environment is buildings
if the environment is tools
then stimulus_situation is 'physical object'
Rule 4:
if the environment is numbers
or the environment is formulas
or the environment is 'computer programs'
then stimulus_situation is symbolic
시스템이다 4 개 규칙을 구현하려는 가 : 입력 할 때. 시스템은 사용자에게 환경 입력을 요청합니다. 입력 된 텍스트가 환경 중 하나 인 경우 시스템은 stimulus_situation을 출력해야합니다.
그래서이 코드를 작성하려고했지만 작동하지 않습니다. 그리고 왜 저를 도와 줄 수 있는지 모르겠습니다.
go:- check(Env), write('enviroment is :'),write(Env),nl,undo.
check(verbal):- verbal,!.
check(visual):- visual,!.
verbal :- verify(enviroment).
visual :- verify(pictures).
ask(Question) :-
write('What is the Env?!'),
write(Question), write('? '),
read(Response), nl,
((Response == papers ; Response == manuals ; Response == manuals; Response == textbook)
-> assert(yes(Question)) ;
assert(no(Question)), fail).
:- dynamic yes/1,no/1.
verify(S) :- (yes(S) -> true ; (no(S) -> fail ; ask(S))).
시도하기 위해 2 가지 규칙으로 작성했지만 작동하지 않습니다.
미리 감사드립니다. 나는 당신의 설명에서 알 수있는 바와 같이
당신이 "그렇지 일을 수행"을 의미합니까를? – coder
@coder 전혀 작동하지 않습니다 –
변수가 무엇입니까? – Eyal