by JL Popyack


This assignment provides introductory experiences with production systems, agents and working with Python and LISP programming, plus a view of current practices in artificial intelligence.


This assignment consists of two sections:

  1. Written problems to be turned in.
  2. A Python and/or LISP programming assignment to be completed.
Click here to return to top of this page.

  1. Written Problems to be turned in:
    1. Current Events - Mundane Systems (15 points): Read the March 23, 2010 EE Times article, . Write a paragraph summarizing the main points of the article. Discuss whether you think the work discussed represents a promising direction or is headed to a dead end. Justify your conclusions. Now, stop and do some thinking: aside from assisting persons with motor disabilities, where can you see this technology as useful? Suggest a future use for this technology and discuss its feasibility.
    2. Current Events - Intelligent Agents and Learning Systems (15 points): Read the August 20, 2005 New Scientist article by Duncan Graham-Rowe, "How bots can earn more than you do". Write a paragraph summarizing the main points of the article. In a separate paragraph, discuss the following:
      • Do you think equities trading bots can ever completely replace human traders? Why or why not?
      • What do you see as the future of equities trading if every trader is using intelligent agents?
      • The article discusses poker-playing bots. Discuss similarities and differences of online poker vs. equity trading. How do your answers regarding equities trading bots differ for poker-playing bots?
    3. Production Systems (40 points - 20 points each): Specify a knowledge base, rules (precondition/action pairs), initial state, state representation, and a goal/termination condition for the following problems. Be as explicit as possible, providing a specific data representation for the states and rules and showing how the results of applying a rule to a state are determined. You do not need to specify an algorithm for solving the problem; possible algorithms for choosing between applicable rules will be covered later:
      1. Losing Your Marbles: Each of three baskets contains a certain number of marbles. You may move from one basket into another basket as many marbles as are already there, thus doubling the quantity in the basket that received the marbles. You must find a sequence of moves that will yield the same number of marbles in the three baskets (or decide that no such sequence exists).
      2. The Sliding-Tile Puzzle consists of three black tiles, three white tiles, and an empty space in the configuration shown below:

        The puzzle has two legal moves with associated costs:
        • A tile may move into an adjacent empty location. This has a cost of 1. (cost is not important for this exercise)
        • A tile can hop over one or two other tiles into the empty position. This has a cost equal to the number of tiles jumped over.

        The goal is to have all the white tiles to the left of all the black tiles. The position of the blank is not important.

    4. Chapter 2 (Intelligent Agents) - 10 pts: For each of the following agents, develop a PEAS description of the task environment (as in Figures 2.4-2.5), and characterize the task environment (as in Figure 2.6):
      1. automated supermarket checkout agent.
      2. intelligent toaster.
  2. Click here to return to top of this page.

  3. Programming Assignment - Search/Functional Programming Beginnings (20 points) :

    Childrens’ puzzle books often contain Word Search puzzles like the one shown at the right. These problems are fun enough to solve, but how are they created? 

    For the next several assignments, you will be writing a Python program to create such a puzzle, using various search strategies. For extra credit, you may additionally write a LISP program to solve it. For either language, you should use a functional programming approach and representation as described below (e.g., we will use Python list representations which closely match their LISP counterparts). For this assignment, you do not have to implement a solution strategy, other than the "flail wildly" search strategy, which is used to demonstrate that your routines work.

    To write a program to solve this problem, we will need to have

    • a way to represent the problem, and
    • functions to carry out various aspects of the problem, using this representation.

    The purpose of this exercise is to develop some of the functions necessary to create such a puzzle. Future exercises will build on this foundation, until eventually the problem is solved.

    The knowledge base for this problem consists of a m×n grid and a list of k words to be placed in the grid. The state s=(grid,words) will be a partially filled-in grid and a list of words that still need to be added to the grid.

    A rule r can be characterized by the five attributes (i, row, col, dh, dv), and is defined by the following action and preconditions:

    • Action:  Insert word[i] in grid, starting at position [row,col] and continuing in direction [dh,dv], where -1<= dh,dv <= 1 and |dh|+|dv| >0
    • Precondition: word does not extend beyond edge of grid
    • Precondition: word does not conflict with existing words in grid

    For instance, word[7]="heuristic" was placed in the top left corner of the grid, proceeding in the horizontal direction, by applying rule (7,0,0,1,0) and word[0]="admissible" was placed in the grid by applying rule (0,9,10,-1,-1).


    Each of the words at the bottom appears once in the grid, either horizontally, vertically or diagonally, forward or backward. 
    Find each word and circle it.

    H E U R I S T I C S A L
    A C L A B I N N A C E P
    I K R B Y R T E M M Y S
    A P C A I N E E A R I I
    H C R A E S H P A R G L
    U O E G R S S N M L D L
    A P A R A T O I O Y N I
    R T T H I I K B M U E H
    T I A O S G A C D D D G
    A M M S P L O C A L A I
    S U I I L D I A A B E E
    K M A I H A I T L R D G
    Admissible Agent Backtrack
    Cannibal Deadend Global
    Graphsearch Heuristic Hill
    LISP Local Missionary
    Optimum Search Symmetry

    Puzzle produced by Armored Penguin

    Using this representation, write the following statements and functions, and test them using Python, showing your output.

    1. Assign an empty m×n grid and the full list of words {word[0],…, word[k-1]} to initialState.
    2. Write a function goal(state) which returns true if state.words equals the empty list.
    3. Write a function applyRule(rule,state) which returns the value of applying a rule to a given state. This does not change the value of state.
    4. Write a function precondition(rule,state) which returns True if the given rule may be applied to state, that is, the preconditions are satisfied. For instance, given the value of initialState, the precondition for rule (7,0,0,1,0) is satisfied (and True is returned) because the word fits in the grid and there are no other words in the grid that conflict with it. Note, however that False is returned for the rule (7,0,8,1,0), because the word does not fit in the grid when starting at position [0,8] and filling forward in the positive direction. Likewise, suppose "heuristic" has been placed successfully with the first rule and the new state is state2. Then if rule2 is (0,9,10,-1,-1) , precondition(rule2,state2) returns True because the final letter 'e' overlaps with the letter 'e' in position [0,1]. However, the rule (0,9,11,-1,-1) would not satisfy the preconditions for this state because it does not overlap properly with existing words in the grid.
    5. Write a function generateRules(state) which calls precondition and returns a list of all possible rules that may be applied to the current state, where rules have the form described above. This should be a list of all possible words, starting positions and directions which satisfy the preconditions for the given state.
    6. Write a function describeState(state), which shows the partially filled in grid and lists words still remaining to be placed in the grid.
    7. Write a function describeRule(rule), which explains the meaning of the given rule, e.g.,
      Place the word "admissible" in the grid starting at position (9,10) and proceeding in the direction [-1,-1].
    8. Test these primitives by writing a routine flailWildly(state), which repeatedly tests goal(state) and if a goal has not been reached, determines all applicable rules for the current state, chooses one randomly and applies it. At each step, describe the current state, describe each applicable rule, and describe which rule has been chosen.

Click here to return to top of this page.


All homework for this course must be submitted electronically using Bb Vista. Do not e-mail your assignment to a TA or Instructor! If you are having difficulty with your Bb Vista account, you are responsible for resolving these problems with a TA, an Instructor, or someone from IRT, before the assignment it due. It is suggested you complete your work early so that a TA can help you if you have difficulty with this process.

For this assignment, you must submit:

Strongly recommended. We strongly recommend using a compression utility (such as StuffIt or WinZip - download a free demo) so that you can compress your files into a single file (with a .zip extension) and just upload it, rather than go through the tedious and error-prone process of uploading each file separately.

Click here to return to top of this page.


You must compose all program and written material yourself, including answers to book questions. All material taken from outside sources must be appropriately cited. If you need assistance with this aspect of the assignment, see a consultant during consulting hours.

Click here to return to top of this page.