Note: For this lab, you can work together in teams of up to 4 students. However, this is not a necessity. The assignment is small enough to do it alone in which case you may get more experience. You can use Piazza to find team members and discuss problems.
You will need a Java Development Kit (JDK) and a Java IDE (any text editor should do as well).
The following logic puzzle is known as Zebra Puzzle or Einstein Puzzle (source: Wikipedia). It was first published in the Life International magazine in 1962. Also, exercise 6.6 in the book is a slight variation of that puzzle.
In five houses, each with a different color, live five persons of different nationality, each of whom prefers a different brand of cigarettes, a different drink, and a different pet. The five houses are arranged in a row (no house has more than 2 neighbors, two houses have just 1 neighbor).
Now, who drinks water? Who owns the zebra?
The Java project for the lab can be found on Skel. See, instructions below on how to get it.
The project contains a Main class which sets up and solves the CSP, as well as some additional classes implementing the constraints. You need to implement a few parts in Main.java and a method in DifferByOneConstraint.java (if you need that constraint). To run the code simply run the Main class or use “ant run” on the terminal.
Connect to skel.ru.is using your favorite ssh client and unpack the assignment into your home directory by running the following commands:
[student14@skel ~]$ tar xvf /labs/arti16/lab3/lab3.tar [student14@skel ~]$ cd arti16/lab3 [student14@skel hw1]$ ls answers build.xml dist Makefile questions src
You can copy the code to your own machine for development by using any SCP or SFTP client (e.g., WinSCP). However, you need to copy it back to skel before handing in.
To answer the questions run
make answers while being in the directory containing
Single answers will be put into files called
answers/answerX.Y.txt, which you can also edit.
Finally, to hand in your answers run
make handin while being in the directory containing
This should produce a file
/labs/art16/.handin/lab3/student14/handin.tar.gz. You can check if it exists using the ls command or by running
rutool check -c arti16 -p lab3.