CPSC 352 -- Artificial Intelligence -- Fall 2011
Homework -- Due: Fri, Nov. 4
PROLOG: Simplified Knight's Tour

  • Part 1. This part is similar to problem 7 on page 221 of our text. Generalize one of the two solutions to the simplified Knight Tour problem that we covered in class. That is, write PROLOG code to extend the simplified Knight Tour to the full 8 x 8 chessboard. You can use either one of the following programs as your starting point:

    This part of the assignment requires you to create rules that define move(X,Y) for the 8 x 8 chessboard. Your solution should define the 8 types of knight moves (rather than relying on an exhaustive list of the individual moves).

    Make sure you modify the comments in the program to reflect your solution. Provide a listing of your source code and a trace that shows that your solution works properly on the following examples:

    	path(2,15).
    	path(1,63).
    

  • Part 2. The purpose of this part of the assignment is to get ready for the final programming assignment, which will be to develop a heuristic version of the sliding tile puzzle.

    Incorporate your solution to Part 1 into the heuristic search program, whose main program is given in knight.heur.pl. This program makes use of several other PROLOG programs that you need to download by clicking on the following links:

    Recall that best-first search uses a heuristic/3 predicate. By setting that predicate's 3rd parameter to 0, you can perform an exhaustive breadth-first search using your knight moves. For this assignment you will just do a breadth-first search.

    Incorporate your solution in Part 1 into the best-first search program. Just replace the name of your file for the 'knights16v2.pl' file in the setup/0 predicate. To run this program, you must first run the setup/0 predicate. Then run start(X,Y), replacing X and Y with the starting and ending numbers for the knight's path. The program should perform a breadth-first search using your moves and print out a solution path. Again, to perform breadth-first you must set heuristic(_,_,0). In the next assignment you will replace breadth-first with a heuristic search by defining a non-trivial version of heuristic/3.

    HAND IN DIRECTIONS: