Computer Science Department

CS4341 ❏ Artificial Intelligence

Version: Wed Mar 13 17:16:39 EDT 2013

PROJECT 0 - Setting the Stage

Due Date

This project is due on Fri 15 Mar


The purpose of this project is to:

  1. Provide you with an early opportunity to revise and practice your Scheme/LISP if you decide to use one of those;
  2. Produce some data structures and code that will be used in the other projects;
  3. Refresh your memory of basic searching techniques.

Task 1

  • Use Java, or Scheme/LISP.
  • 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 the city of Worcester.
  • For reference purposes the area is divided into many small square cells.
  • Each cell can have a variety of properties that will 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. Obstacles can't share cells. Vehicles can't share cells with obstacles.
  • Each part of the land may have an elevation. The default is zero. Assume that the cells are smoothly joined.
  • 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 at least one destination location, 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 eight (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 uniform cost 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 three 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 slightly less.
    • Return a measure of the work being done by the program during the search, and explain it.

  • 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, white is an elevation of 0, 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 a uniform cost 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 (i.e., work done) 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 some system-provided 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.


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.