CSCI 1321 (Principles of Algorithm Design II), Fall 2007:
Homework 8
Design 20 points; code 40 points.
The goal of this homework is to make your game as polished as possible
in the time remaining -- both from the standpoint of a person
playing it and from the standpoint of a person reading your code.
If you think what you turned in for Homework 6 is as perfect
as you can make it, just resubmit it for this assignment;
if I agree, you'll get full credit.
There are several categories of improvements you should consider
making:
- Fix any known bugs in your code, including adding classes
you didn't write in previous assignments (for example,
you want to have two kinds of enemies but only implemented
one in earlier assignments).
- Improve the look of the game in whatever way seems appropriate --
for example,
by using the screen editor to draw a more complex map,
by using the image editor to create
nicer images for blocks and entities,
or by figuring out how to import
images from files in graphics formats (GIF, etc.).
This could also be a time to change from moving in
whole-block units to moving in partial-block units.
I discouraged this early on because the logic is a bit
more complex, but it turns out to be less complex than
in previous years because of additional functionality
in the game framework.
- Tidy up your code. This includes
correcting any problems I pointed out in grading your other
assignments (yes, I know that I haven't returned comments on
all your work yet), as well as the following.
- Try to avoid duplicating information in a way that
makes it difficult to change (i.e., you must change
something in multiple places). Examples:
- If you create an array (in your screen class, for
example), by writing
Block[][] blocks = new Block[20][30];
then elsewhere in the class you should use
blocks.length (not 20) for the number of rows
and blocks[0].length (not 30) for the number of
columns.
Outside the class you should also avoid hardcoding the 20
and 30 (or obvious variants such as 19 and 29) as well.
(For the dimensions of a screen s, you can use
s.getSize().height and s.getSize().width.)
- Once you've used
Location.setPartialsInWhole() to set the
``partials in whole''
number, you should use Location.getPartialsInWhole() to
get the value rather than hardcoding the desired number.
- Try to avoid duplicating code. If you have the same
code repeated multiple places, especially if there's a lot
of it, consider making the duplicated code a private method.
- Be sure all instance variables for a class are declared
in one central place (top or bottom) rather than being
scattered throughout the class.
- Be sure visibility of methods and instance variables
(public, private, etc.) is
sensible. Variables should normally be private;
methods should be public if needed outside the class,
private if not.
- Be sure names of classes, variables, and methods are
consistent with Java naming conventions: Classes are mixed-case
starting with upper case, constants (static final
variables) are upper-case, and other variables are
mixed-case starting with lower case.
- Remove or comment out any code that prints debugging
information.
- Make the documentation consistent with the current state of
the code and reasonably complete. I will grade the HTML
version of your documentation, so be sure it includes
everything you want me to read. If you haven't already done
so, at this point you should do the following.
- Be sure every class, and every public method or variable,
has at least a brief comment describing what it is
and how it fits into your game. (Exception: You do
not need to describe how your list and priority queue
classes fit into the game, just what they are in
general -- e.g., ``linked list of game entities''.)
For methods, also describe parameters and return
values, unless their purpose is clear from their names
and the overall comment about the method.
- Be sure comments are consistent with the final state of
the game. Ideally they will all be your comments
rather than Dr. Lewis's instructions for how to use
his code (this is particularly applicable to your
game setup class).
- Undo any changes you made
for Homework 7 that would make the game
less playable -- i.e., either remove the code to process
command-line arguments and print timing information, or
revise things so that if no command-line arguments are
supplied the program uses sensible defaults and doesn't
print timing information.
- The JAR file for this assignment,
PAD2F07Assn8.jar.
(This JAR file is essentially the same as the one for
Homework 5, included again here for completeness.)
- Project Description.
- Project API (Lewis game framework).
- Java library API.
- Help for Dr. Lewis's
screen editor
program.
Instructions for starting the program can be found
under ``Project tools'' near the end of the
Project Description.
- Help for Dr. Lewis's
image editor
program.
Instructions for starting the program can be found
under ``Project tools'' near the end of the
Project Description.
This is a nice program for creating images for your blocks
and entities,
but if you have another favorite tool, you can probably use
that. Ask me for details about loading images from files.
Berna Massingill
2007-12-12