COMP 3007 W22 Assignment 8

Assignment Specification

COMP 3007 A/B (Winter 2023) − “Programming Paradigms”

Specification for Assignment 8

Your submission for this assignment must be commented and must include both your name and your
student number as a comment at the top of every source file you submit. Each of your submitted files must
use a file name beginning ‘comp3007_w23_#########_assignment_08’ (replacing the number signs with
your own student number) and using the file extension ‘.prolog’. Any submissions that crash (i.e., terminate
with an error) on execution will automatically receive a mark of 0.

Officially, the Due Date for this Assignment is:

Friday, April 7th, 2023, at 11:59pm EST.

Late Submissions are Accepted Without Penalty Until Sunday, April 9th, by 11:59pm EST.
Submissions received after that will not be accepted and will receive a mark of 0.

The objective of this assignment is allow you to practice with strategic problem solving in Prolog. For this
question, you must write a Prolog program that will solve the following puzzle by modeling it as a finite state

A group of four humans – two adults and two children – have found
themselves on the east bank of a river. They need to cross to the west side
of the river, and the only vehicle available to them is a small rowboat. The
rowboat can carry at most one hundred kilograms and it requires at least
one human to “pilot” it across the river. Thankfully, the rowboat can be
piloted by either a child or an adult. The adults each weigh one hundred
kilograms, but the children each weigh only fifty kilograms.

Is it possible for all four humands to cross the river in *nine* moves or less?

For this assignment:

• you must design and describe (in detail, as comments in your code) how you will represent a “state”
in your finite state machine presentations of this problem.

• you must design and implement predicates for handling the transitions in your finite state machine,
and these predicates must use the state representation approach you have described above.

• you must design and implement one or more predicates to actually find the solution to this problem.

• you must ensure that the last predicate you implement above (i.e., the one that it actually used to find
the sequence of actions that corresponds to a solution) actually stores the solution in a list and
displays it for the user using the “write” function.

• you must not use any built-in functions other than “length” and “write”.