[an error occurred while processing this directive]
This assignment is due Monday, December 4th at 4:00pm.
Important Note: Late assignments will not be accepted! |
Download the file A05.zip and extract
the files to the cs133
folder on your Home
directory.
You will use these files to complete this assignment. These files contain methods
which we expect to be implemented without changes being made to the method signatures.
You are allowed to add helper methods.
For this assignment, we will return to the Daleks game from Assignment 2 and extend it in two ways.
For the first extension, the game will now continue over a series of levels
1 through 12. At each level, the number of Daleks
chasing the Doctor
will be 1 + (2 * level). Once again, the game is over if the Doctor
is captured. If all of the Daleks
on a given level have crashed,
the next level starts with the correct number of Daleks
. As before,
all participants start at random locations, but for this assignment each participant
must start at a different location (unlike before, where there could be crashes
or captures from the initial positions). After level 12 is reached, the game
continues until the Doctor
is captured but the number of Daleks
does not increase. To make enough space for all of the participants, make the
playing board 20 by 20.
For the second extension, you will implement the Board
class to
play the game, replacing our version. You only need to implement the public
Board
methods defined in the Board.java
class contained
in A05.zip, for a 2D board. Because you do not have the capability of implementing
the getClick()
method, interaction between your Board
class and your Daleks game will have to be done through the use of a listener
object. This will be done in a manner that is almost identical to the use of
the MouseListener
discussed in class (which you will also need
to use in order to capture mouse clicks on your Board
).
Note that your implementation of the Board
class must
provide a general game board that can be used to implement a variety of games
and programs, like the original Board
. It must not contain any
code that is specific to the Daleks game. When your Board
class is complete, you should be able to run your version of Assignment 4 with
your Board
to display pictures without making any changes to your
Assignment 4 code. With some work (to change the way mouse events are handled
using the listener), you should also be able to run the Eight Men in a Raft
puzzle from Assignment 3 on your new Board
. If you include Dalek-specific
code in your Board
class, you will lose marks.
Included in the classes for the assignment is the interface BoardListener
,
which defines the method squareClicked(Coordinate coord)
. This
method should be called on a registered listener object by your Board
class whenever a square is clicked, with the location of the click provided
in the supplied Coordinate
parameter. The CatchGame
class should implement this interface and be registered as the listener
object.
Your new Board
class should include a method to register a BoardListener
object (just one in this case, to keep it simple). On a mouse click (handled
with a MouseListener
somewhere in your Board
implementation),
a new Coordinate
object containing the board position of the click
(not the pixel coordinates provided by mouse events) should be created and the
squareClicked(Coordinate coord)
method should be called on the
registered listener. If no listener has been registered, the mouse click should
be ignored. Your Daleks game will need to be changed to use this new method
of obtaining mouse clicks. You should use the version of the Coordinate
class that was provided with the original Board class.
Correctly implementing the extended Daleks game with your own Board
class (including proper documentation and style (as described in the CS
133 Programming Style Guide), and the use of stepwise refinement) will get
you 100% for this assignment. However, you have the opportunity to get a mark
of more than 100% by including one or more extensions listed in the next section.
We suggest that you tackle Assignment 5 by following the steps below:
Board
class, based on feedback from the markers, comments on common
errors for the assignment, information from the presentation in Lab 06,
and any help you received in Lab 09. When fixing your assignment, try to consider
how to implement the game by determining which objects should be responsible
for each part of the overall functionality (which means there should be code
in all of the classes and methods originally provided with Assignment 02).
You may even consider reimplementing Assignment 02, taking into account all
that you've learned since Assignment 02.Board
class.Board
class based on the information from Lectures 19 and 20. Board
is complete, change your Daleks game to handle
mouse events in the new manner described above.Board
class.Following these steps should make the assignment easier to manage. Further,
if you experience problems when implementing the Board
class, you
can be reasonably certain that the problems exist in your Board
and not in your game. Finally, following these steps will discourage you from
including Dalek-specific code in your Board
class.
It is possible to substantially increase your mark (beyond 100%) by implementing one or more of the following enhancements. These enhancements include improvements to both the Daleks game and your Board class. Be sure to get the required part of the assignment (as described above) working completely and correctly before starting any enhancements. If the required part doesn't work, it will not be possible for us to evaluate your enhancements and your time will be wasted.
A good idea is to save a copy of your assignment before you start the extensions and after you complete each extension. That way, you will always have a working version you can submit when the due date arrives.
Note that you don't have to implement the extensions in the order in which they are shown here. However, some extensions build upon one another or are related.
Board
class that
allows a user to start a new game at any time and quit.Doctor
and the Daleks
.
Be sure to properly acknowledge the source of any graphics you use.Doctor
cannot move into a
square where he will be captured on the next move by any Daleks
.
That is, the Doctor
should not be allowed to move onto a square
containing a Dalek
or onto any square immediately adjacent to
a Dalek
. If the player attempts to make such a move, display
a warning message on the board. If the Doctor
has no safe moves,
then he must teleport. Doctor
,
in addition to normal (or unsafe) teleports. Start with 5 for the
entire game. The Doctor
can choose to use a safe teleport if
he has one, or choose an unsafe teleport at any time. With a safe teleport,
the Doctor
is guaranteed not to land on a Dalek
or immediately adjacent to one (so no Dalek
can capture the Doctor
on its next move). With an unsafe teleport, the Doctor
is teleported
to a random square, where he may be captured immediately (either landing on
a Dalek
or immediately adjacent to one). The number of safe teleports
should be displayed somewhere on the board.Doctor
to select between the two forms of teleport. One option is to add a menu called
"Teleport" that provides options for both forms of teleport. Another
option is to provide two buttons on the board, one for each form. Regardless,
when the Doctor
exhausts all available safe teleports, the menu
option or button should be greyed out so that it cannot be selected. For the
keyboard interface, use the "*" key as a safe teleport.Doctor
to declare that he will
not make any further moves for this level. This option must be used with care
- if the Doctor
miscalculates the position of the Daleks
,
one may capture him. When the user selects this option, the Doctor
is not given any further option to move - any mouse clicks or keyboard
presses must be ignored. The Daleks
continue to move until
either all of the Daleks
crash (and the next level begins) or
a Dalek
captures the Doctor
.Doctor
should receive one additional safe teleport for each Dalek
that
crashes after the Doctor
has selected this option, up to a maximum
of 5.Daleks
that move two squares at each turn. A speedy Dalek
can crash in either of its two moves.Be sure to document your extensions as described in the CS 133 Programming Style Guide.
This assignment will be submitted electronically. Go here for information on how to submit files electronically.
For this assignment, you may write additional classes not listed here if you
wish. Create and submit a zip file called A05submission.zip
that
contains everything needed to run your program. Read these instructions
if you don't know how to make a zip file. Submit your file using the handin
code 05
.
A05submission.zip
Note that the following class will be replaced with our own copy before your assignment is run:
MainGame.java
You may submit the assignment file as many times as you like prior to the submission deadline; a later submission replaces any previous submission. Submitting early ensures that you are able to submit, and that you will receive some credit if you inadvertently fail to submit your final version of the assignment by the submission deadline.
Late submissions will not be accepted, and no submissions will be accepted via e-mail. It is your responsibility to ensure, prior to the submission deadline, that the submission process works for you, and it is your responsibility to make your final submission sufficiently in advance of the submission deadline as to ensure that there is an adequate margin to allow for unexpected delays.
We will be compiling and running your submission. Be sure the your submission compiles.
After you have gone through the steps for electronic submission (by running an X11 window and executing the submit command), if you want to check to see what files have successfully been electronically submitted, click the button below and enter your Quest password.
Press the button to request that the files for the assignment be compiled and run. This facility is here to allow you to ensure that you have:
You may not request testing for a particular assignment once its late deadline has passed. The results will be emailed to the specified userid upon the next scheduled test run (every 10 minutes).
Part of your overall assignment mark will come from a brief interview with the TAs and Tutors. During this interview you will be demonstrating your program with the enhancements you have made. Marking will take place on December 6 and 7. Each interview will take approximately 15 minutes to complete. Click on the button below to login and schedule your marking time. If you are having troubles booking a time or logging in, please email or see a tutor.