One of the earliest examples of a conversational agent, or a chatterbox, is Joseph Weizenbaum’s Eliza (written in the LISP language). It is considered a first attempt to approach the Turing test’s paradigm.
Eliza is a very straightforward program – it simply rephrased the input back to the human, typically in the form of a question.
Here is an example of Eliza imitating a psychiatrist talking to a patient:
Patient: I’d like to talk about my mother.
Eliza: What else comes to mind when you think of your mother?
Patient: She wants to control me and run my life.
Eliza: Your life?
Patient: Yes, there are times that I have one.
Eliza: You are sure.
Patient: Why don’t you think I have a life?
Eliza: Do you believe I don’t think you have life?
Obviously, Eliza just looked for patterns, and then rephrased, or picked a random comment.
Write a simple program implementing this or a similar dialog. Use a programming language of your choice.
Include your code, a screenshot of a dialog and a brief comment.
Look up for descriptions of such programming tools as LISP and productions systems to see how they can be applied to implementation of a general algorithms of conversational agents.