CPSC 352 -- Artificial Intelligence -- Fall 1999
Homework -- Due Thursday, November 4, 1999
PROLOG: Missionaries and Cannibals

  • 1. Do problem 9 on page 423 -- i.e., write PROLOG code to solve the missionaries and cannibals problem using the production system architecture proposed in Section 9.3. Provide a listing that provides a trace of the search, such as the following:
          try 1 cannibal rows west to east alone 3 2 0 1
    	Moved to 3 2 0 1 e
          try 1 cannibal rows east to west alone 3 3 0 0
          BACKTRACK from:3 2 0 1
          try 2 cannibals row west to east 3 1 0 2
    	Moved to 3 1 0 2 e
          ...
    
    plus a listing of the solution path, as follows:
       Solution path is
       state(3,3,0,0,w)
       state(2,2,1,1,e)
       state(2,3,1,0,w)
       state(2,1,1,2,e)
       state(2,2,1,1,w)
       state(1,1,2,2,e)
       state(1,2,2,1,w)
       state(1,0,2,3,e)
       state(1,1,2,2,w)
       state(0,0,3,3,e)
    
    For this problem you might want to consult the sample program, cannibals.pro, which provides a partial implementation of the solution.

    PROLOG FTP LIBRARY: PROLOG does not contain a built-in "member" predicate, so you will have to include one in your database. You can ftp a file with some useful PROLOG predicates from the CPSC 352 FTP Site. There are several PROLOG sample programs available there as well. Feel free to have a look there and borrow whatever is helpful.

    HANDIN DIRECTIONS: