我是Prolog初学者。 Prolog没有返回任何错误,但是重复了输出。
有什么建议可以预防吗?
这是我的代码:
venue_type_indoor(X):-
write('Do you to do indoor event?(yes/no) '),
read(X).
venue_type_outdoor(X):-
write('Do you to do outdoor event?(yes/no) '),
read(X).
indoor(yes):-
venue_type_indoor(X),
X=yes.
indoor(no):-
venue_type_indoor(X),
X=no.
outdoor(yes):-
venue_type_outdoor(X),
X=yes.
outdoor(no):-
venue_type_outdoor(X),
X=no.
venue(resort):-
indoor(no),
outdoor(yes),
vip(yes),
student(no),
formal(no),
informal(no),
mix(yes),
write('Your venue is SL Resort').
venue(garden):-
indoor(no),
outdoor(yes),
vip(no),student(no),
formal(no),
informal(no),
mix(yes),
write('Your venue is Green Garden').
venue(hotel):-
indoor(yes),
outdoor(no),
vip(yes),
student(no),
formal(yes),
informal(no),
mix(no),
write('Your venue is Diamond Hotel').