begin:-
go,
initialise. % drive predicate
begin:-
write('Sorry cannot help'),nl,nl.
go:-
write('Below is the list of the current toys available within the
store.'),nl,nl,nl,nl,
loop_through_list([car, football, action_men, train_tracks, lego, football, bikes, control_car, drees_up, doll, bear, furbies, craft, doll_house]).
loop_through_list([Head|Tail]) :-
write(Head),
write(' '),
loop_through_list(Tail).
initialise:-
nl,nl,nl,nl,
tab(40),write('******************************************'),nl,
tab(40),write('*** TOY GENERATING SYSTEM ***'),nl,
tab(40),write('******************************************'),nl,nl,
write('Please answer the following questions'),
write(' y (yes) or n (no).'),nl,nl, nl, nl.
這裏的問題是,go:-
和initialise:-
單獨工作時,而不是當它們放在一起。所有的nl
都有問題嗎?如何讓兩個驅動謂詞在prolog中工作?
不應該有一個冒號'初始化'後?即開始: - 去,初始化。 –
對不起。忘了把它放進去,這只是我的代碼的一部分。 –