Homework 1 

(10 points)

Tetris - Part 1

 

Overview

You will be implementing the game Tetris. Tetris is a deceptively simple, and addictive puzzle game. Small pieces fall from the top of the grid to the bottom. The pieces are comprised of 4 squares arranged into 7 different patterns. Players must rotate the pieces as they fall and fit them together to complete lines. When the player fills an entire line with blocks, that line is removed from the screen. If the player cannot complete lines, the blocks will eventually fill to the top of the screen and the game ends.

Concepts

The purpose of this assignment is to gain experience with the following  concepts:

Program Synopsis

In the real game of Tetris, a tetris piece, composed of 4 contiguous squares, falls from the top of the grid. The piece can be moved left, right, or down as well as rotate clockwise. When the piece lands on the bottom of the grid or another piece it becomes frozen, that is to say, a part of the grid, and then another piece is created. If an entire row fills up with parts of different pieces, then the entire row is removed and the rows above it are moved down. Play continues until the pieces pile up to the top and a new piece is created on top of already frozen pieces.

The starter code for this project  implements a simple game that only creates a single L-shaped piece that can move downwards. It uses elementary keyboard input and graphics classes.  For Homework #1, you will add specific features to make it a more complete Tetris game. (Homework #2 will ask you to produce a complete Tetris game that uses different shapes.)

Download the starter code: EventController.java, Game.java, Grid.java, LShape.java, Square.java, Tetris.java, Direction.java

Here is a description of the different classes.  These first 2 classes have to do with the user interface

The rest of the classes have to do with modelling the game.  Except for the draw(Graphics g) methods, you should be able to read and understand the rest of the code.

Read through and become familiar with the sample code provided.   Determine what the different relations are between different classes and what the different methods do.  Drawings would come in handy here.
 

Overview: For this homework, you will modify the game so that it will produce another L-shaped piece once the current one has stopped moving. In addition, you will add the ability for the L-shaped piece to move LEFT and RIGHT .  Finally, you will implement removal of solid rows from the Grid.

Homework 2 will add the rest of the Tetris game features.

Program Details


Notice here that the bottom 2 rows are filled.  They are removed and the rows above are moved down.

Unit testing

 

Report (should be typed and turned in as a pdf file with the java files on the class website)

Write a short statement that either says that you are in full compliance with the requirements of the assignment or lists the ways in which you are not (things that don't work).

 

Individual evaluation report (should be typed and turned individually on Canvas)

Evaluate this project:

Your program has to be your own.