% Problem 5 (Recursion with read-write loop)
% Implement a predicate, chat, that replies like a simple chatbot % to a word the user types in, & stops when the user types stop. % See the sample dialog below. You can invent your own chatbot % replies, but they should incorporate the user's word. % Implement the interactive loop using recursion.
% Sample dialog: % ?- chat. % hello I am a chatbot % when you see "user:" type a word followed by "." % or type "stop." if you want to stop this nonsense! % user: hello. % Who likes hello? % user: everyone. % What is everyone? % user: nothing. % Do you like nothing? % user: yes. % Could you please stop talking about yes? % user: ok. % Could you please stop talking about ok? % user: stop. % true.