Assignment 2: Chatterbots Have a Party
CSE 415: Introduction to Artificial Intelligence
The University of Washington, Seattle, Winter 2007
The reading for this assignment is Chapter 13 in Introduction to Python for Artificial Intelligence.
Due Friday, January 19, Python code submitted through Catalyst E-Submit at 12:00 noon. Also, bring a hardcopy (printout) of a session transcript to lab representing a sample session with your program (see below for what should be in the sample session).
 
Create a Python program that simulates a character in a dialog. Your program should have some definable personality, such as a widget salesman, entertainment star, political figure, etc. Besides being able to carry on a conversation with a human user, it should be able to join into conversations with the agents created by any member of the class. To do this, it will need to implement certain functions with a strict protocol.
 
Your solution should follow these guidelines:
  • You are welcome to use rules from the Shrink.py program, but each rule must be modified so that the response will be different.
  • Incorporate a "memory" feature into your agent so that the conversation can return to some topic introduced earlier by the user. Make it work in a manner consistent with the character of your agent. (5 points).
  • Incorporate a "cycle" feature into your agent so that when a given rule fires repeatedly in a session, the response is not always the same but changes in a cyclical pattern. At least 3 of your agent's rules should use this feature with at least 2 alternative reponses each. (5 points)
  • Make up at least one rule that uses a random-choice feature to select a response form. (5 points)
  • There should be at least 15 rules in your program.
  • Your program should be ready to use as a module in another program that runs your agent with another agent in a dialog. The interface will consist of three functions that you need to write: one called introduce(), one called respond(theInput), and called agentName().

    The introduce() function should return a string representing a message that tells the name of the agent, what the agent represents and the name and UWNetID of you the programmer. For example, it might return a string containing:

    My name is Rusty Sales, and I sell junky cars.
    I was programmed by Jenny Chrysler. If you don't like
    the way I deal, contact her at jchrysler@u.
    How can I help you?
    
    The respond function should work almost the same way as the one in Shrink.py. But there are two important differences. First, the function will take one argument: the input string. It should compute the wordlist and mapped_wordlist values at the beginning of the function body instead of receiving those as inputs as in Shrink.py. Second, instead of printing out its response, your respond function should return it as a string. This will allow the other agent to receive it as input in the joint-dialog program.

    The agentName function should return (as a string) a short nickname for your agent. This will be useful in printing out a prompt-like identifier when showing lines of a conversation among different agents. For example, the function might return Rusty for example above.

    You can test out your compliance to this interface by downloading the test harness programs.

  • Name your file in the following way, so that we can keep track of the different agents: YourUWNetID.py, where YourUWNetID represents your UWNetID code (i.e., your email user name within the u.washington.edu domain. For one thing, this will guarantee that each of our agents is implemented in a file with a unique name. It will also give the graders an easy way to find your agent within a group, if needed.
  • A session transcript hardcopy is due at the beginning of lab. This should be a printout showing a session with your character, plus a printout of your source code. The session should have between 15 and 25 turns. (One turn is a cycle consisting of a prompt from the system, the user's input, and the system's response.) Each of your rules should come into play in this session.
  • Provide a comment in the code for each of your production rules.

Submission of Revised Dialog Agents:

Submit your revised agent using this special turn-in page so that your agent can attend the Chatterbot Party that will be hosted on the UW server "homer" next week.

Name your file in the following way, so that we can keep track of the different agents: YourUWNetID.py, where YourUWNetID represents your UWNetID code (i.e., your email user name within the u.washington.edu domain. For one thing, this will guarantee that each of our agents is implemented in a file with a unique name. Then zip up that file together with any helper files you may need into an archive with the name revised-agent.zip and submit it.

Due Monday, February 12, at 11:59 PM.