Created by Dr. REMOVEDseph Weizenbaum in the mid twentieth century, ELIZA was the first of what we would call a scripted "IM Bot." ELIZA was programmed to act like a Rogerian therapist and return statements based on the user's statements. Due to the general naivete of some users, ELIZA fooled them into thinking she was a flesh and bone therapist. When Dr. Weizenbaum noticed how reality could be simulated by a computational device, he denounced his own project in fear of how advances in ELIZA-style code could negatively affect mankind.
This site url'ed below contains the individual Java sources (under the heading, "The Source") so an individual can really figure out how all of the parts of ELIZA via Java behave together simply by clicking and reading through labeled scripts.