Computer Science
15-111 (Sections A & B), Spring 2007
Homework #5
Due: Wed
14-Feb-2007 at 8:00pm (online submission).
Place this
program in hw5.zip. Remember to just
submit your .java files, and not your .class files, random .jpg files, or
miscellaneous Eclipse or other IDE-related files.
Tetris
Write the game of
Tetris, as described in class this week.
This is left quite open-ended, so you can make broad decisions about the
visual design of the game and the structure of your code. This is also a Pair Programming Lite
assignment (see syllabus for details).
To receive a C, your program must:
1. Display a board.
2. Drop random pieces, including all
the standard pieces of a standard Tetris game.
3. Pause and unpause the game in
response to the ‘p’ key being pressed.
4. Move the falling pieces left and
right in response to left and right arrow key presses.
5. Stack the pieces at the appropriate
time (when they would otherwise collide with another piece or fall off the
board)
To receive a B, your program must do
all that, and:
6. Rotate pieces 90° counterclockwise
in response to up-arrow key presses (and do this rotation properly, including not rotating if it would result in the
piece rotating offscreen or colliding with another piece)
7. Remove rows as they are filled up
anywhere on the board
8. Keep score, including receiving more
points when multiple rows are removed at once than if the same number of rows
were removed one-at-a-time.
9. End the game when a newly-falling
piece immediately collides with a piece on the board.
10. Have well-designed, well-commented
code.
To receive an A, your program must
do all that, and:
11. Have a really nice, understandable,
helpful, visually-pleasing GUI
12. Have at least two additional clever,
well-designed, and well-documented features.
(The documentation is critical – it must be obvious from a comment at
the head of your file what these two features are and how they are
implemented.)
To receive BONUS:
You may add additional features for up to 10 points of bonus. For example, a piece editor allowing new
pieces to be designed would be a fine feature!