Computer Science Department

CS4341 ❏ Artificial Intelligence ❏ B07

Mon, Tue, Thu, Fri - 1:00 - AK 233
Prof. David C. Brown, Fuller Lab 131, (508) 831-5618, dcb at cs.wpi.edu

Version: Fri Oct 19 19:49:29 EDT 2007

PROJECT 0 - Setting the Stage

Due Date

This project is due on Tuesday 30th October 2007


The purpose of this project is to:

  1. Provide you with an early opportunity to work with LISP or Scheme;
  2. Produce some data structures and code that will be used in some of the other projects;
  3. Refresh your memory of basic searching techniques.

Task 1

  • Use LISP or Scheme.
  • Design and implement a data structure that represents a square area of land: it could be the surface of the moon, the 2nd floor of the Campus Center, or Worcester.
  • For reference purposes the area is divided into many small square cells.
  • Cells can have a variety of properties that may need to be recorded.
  • Cells can be marked as occupied by obstacles, such as buildings, ditches/pits, stationary vehicles, or rocks. Record the obstacle and its type.
  • Cells can be marked as occupied by vehicles. A single vehicle is considered to occupy just one cell. Record the vehicle and its type.
  • Vehicles can't share cells, neither can obstacles. Vehicles can't share cells with obstacles.
  • Each part of the land may have an elevation. The default is zero.
  • Some zones of the land are more expensive to be in and entering them requires payment of a toll.

Task 2

  • Use the implementation developed in Task 1.
  • Given one starting location, and one or more destination locations, plan a route for a vehicle from the start to a destination. Finding one destination is sufficient.
  • Assume that the vehicle can move one cell at a time in any of the 8 directions to an adjoining cell (i.e., including diagonals).
  • First, do it using a depth first search.
  • Second, do it using a breadth first search.
  • Third, do it using a best first search that tries to both reduce engine wear by avoiding climbing, and also saves money by avoiding zones (i.e., it follows the currently lowest cost partial path each time).
  • In all cases you must:
    • Return the path found.
    • Return the accumulated cost of that path by:
      • Assuming that cell to cell gas costs are constant (e.g., $1).
      • Adding toll costs every time a more expensive zone is entered (e.g., $10).
      • Use the change in elevation as a multiplier: climbing hills uses more gas, coasting down hills uses less.
    • Return a measure of the work being done by the program.
  • Use the following example as the first test case, for all three types of search.


      . * *

      * * *

      * * .


    Where black squares are blocked, other squares are not, S is the Start, D is the Destination, a * indicates a toll zone costing $10 to enter, gas is $1 a cell transition, yellow is an elevation of 2, orange is an elevation of 4, and red an elevation of 6.

  • Devise a second test case that prevents any search from being successful, and demonstrate how best first search performs. Try to make the test case revealing, not just one that fails immediately.
  • Devise a pathological test case that shows the worst successful performance of the depth first search, and demonstrate how depth first search performs.


An adequate demonstration that the program works is required. That is, the program should not only present the "answer", but should also show how it got to that answer, in the form of some clear, formatted, explanatory, trace-like output. This can be facilitated by writing a set of problem-dependent functions, with embedded printing, and then using those to program the solution. Using the Trace function provides a much weaker result, and should be avoided. The demonstration serves to show the reader how it works, and also that it works.

If additional test cases, other than those specified, are required to adequately demonstrate the performance then these should be included.


For the due date, see the Schedule. Projects must be completed by the start of class on the due date.

Make sure that your name is associated with all items submitted.

You must submit:

  • On paper and via web turnin:
    • Clear documentation (pdf) that describes the design of your data structure, as well as your search algorithms.
    • A description of the design of and results from each test case.
  • Via web turnin only:
    • All the test cases in your demonstration with the corresponding output that shows that the code is functioning correctly.
    • All the code (which must be well commented).

How to submit:

Please note:

  1. Clearly label all printed work with your name.
  2. Clearly label each file with a helpful name.
  3. ZIP your entire project directory. Make sure it only contains the files to be submitted. Use "zip" and not some other compression tool.
  4. Name the zip file as your user name + "-proj0.zip"   For example, "jefferson-proj0.zip"
  5. Submit the zipped project using web turnin.
  6. The project's turnin assignment name is "project0".
  7. Your turnin password should have been emailed to you.
Please let us know if you still have problems.