Assignment 1: Search and CSPs
CSC384H Fall 2009
Out: September 16th, 2009
Due: Sunday, October 4 at 11:59 p.m. (submit system deadline).
Worth: 15% of your final mark.
This assignment is divided into two parts: one involves programming and the other does not. The
programming piece of the assignment will be worth 27% of the assignment grade. The answer to
written questions will be worth 73% of the assignment.
Note that you can talk about this assignment with your classmates, but we expect each of you to invent
your own heuristics, to work on the written questions independently, and to write your own code.
Please start this assignment early so you can budget your time well!
Part One: Search (9 pts total)
The Programming Component (4 pts, or 27%)
The Jonas Brothers and their drummer (Jack Lawless, aka “Flawless Lawless”) have a concert that
starts in 21 minutes and they must all cross a bridge to get there. All four men begin on the same side
of the bridge. It is night and they have only one flashlight. A maximum of two people can cross at one
time. Any group that crosses, of either 1 or 2 people, must have the flashlight with them. The flashlight
must be walked back and forth; it cannot be thrown or returned in any other way. Each band member,
moreover, walks at a different speed as follows:
Kevin takes 4 minute to cross,
Joe takes 5 minutes to cross, Nick takes 1 minute to cross and Jack
(“Lawless”) takes 10 minutes to cross (slow, one might think “flawed”).
A pair must walk together at the rate of the slower man's pace. For example, if Kevin and Jack walk
across first, it will take 10 minutes to get to the other side of the bridge. If Jack then returns with the
flashlight, a total of 20 minutes will have passed and you will have failed the mission.
You must show how to get the band members across in time to start the concert.
The concert’s sponsoring organization, Disney, is understandably concerned.
They have therefore
provided you with code for a variety of search algorithms to help you get started, as well as some
examples of their use, all of which are written in SWIPROLOG. The files they have given you include:
1. A* search (astar.pl). This is code for A*, which allows states to be visited more than once.
2. A* search (astarCC.pl). This is code for A,* which does not allow states to be visited more than