Santa's Workshop
The Problem
- Santa
Claus sleeps in his shop up at the North Pole, and can only be wakened
by either all nine reindeer being back from their year long vacation on
the beaches of some tropical island in the
- South Pacific, or by some elves who are having some difficulties making the toys.
- One
elf's problem is never serious enough to wake up Santa (otherwise, he
may never get any sleep), so, the elves visit Santa in a group of
three. When three elves are having their problems solved, any other
elves wishing to visit Santa must wait for those elves to return.
- If
Santa wakes up to find three elves waiting at his shop's door, along
with the last reindeer having come back from the tropics, Santa has
decided that the elves can wait until after Christmas, because it is
more important to get his sleigh ready as soon as possible.
- It
is assumed that the reindeer don't want to leave the tropics, and
therefore they stay there until the last possible moment to return.
- They
might not even come back, but since Santa is footing the bill for their
year in paradise it's to the reindeer's advantage to return eventually
before Christmas. However, this may also explain the alacrity with
which presents are delivered, since the reindeer can't wait to get back
to where it is warm.
- The penalty for the last
reindeer to arrive is that it must notify Santa while the others wait
in a warming hut before being harnessed to the sleigh.
Team Responsibility
You
are to design and implement a solution to this problem, in Java, for
one year. After the delivery of the presents for the year, Santa's
return to the North Pole, and the departure of the reindeer for the
tropics, your program must terminate.
We strongly
suggest that you implement a test bed allowing you control over the
arrival of elves and reindeer, and Santa fixing problems and delivering
toys, and use it to collect some statistics to demonstrate the
behaviour of your program.
You should make and document
plausible assumptions about arrival times etc, noting that reindeer
only arrive near to Christmas, while elves may arrive at any time
(hint: insert a relatively large initial delay for each reindeer).
Experiment with different assumptions to see their effect, and document
the results. In addition to the well-structured and well-documented
Java source code, you must write a report that details your design
(especially decisions related to concurrency), alternatives you
considered, and the results of your experiments (e.g., were any race
conditions uncovered? were you able to correct these?)
Submission
Submit your
team's solution to the Project 1 - Santa dropbox by due date and time
shown in the course schedule. The submission is to consist of one ZIP file, santa.zip, containing the following:
- Java source file Main.java, with a class Main that has the public static void main method to launch your program.
- Java source files, in the default package, for the other classes in your solution (Santa.java, Elf.java and Reindeer.java at a minimum).
- A README.txt
file giving instructions as to how your program is to be executed.
Include in this any mechanisms for interacting with the program, and
configurable constants and the source file where they reside, and a
description of the output format produced.
- A PDF file Report.pdf addressing the issues and questions in section Team Responsibility.
- There must be no directories in the zip file - everything must be at the top-most level.
Any team failing to abide by these instructions will receive a grade no greater than 80.
Acknowledgements
This assignment is based in large measure on a similar assignment from Victoria University in New Zealand.