Question: prolog programming % Problem 5 (Recursion with read-write loop) f Implement a predicate, chat, that replies like a simple chatbot % to a word the
% Problem 5 (Recursion with read-write loop) f 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. & Write your solution here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
