## CS 696: Advanced OO Spring Semester, 1997 Project: Tetris

To Lecture Notes Index
San Diego State University -- This page last updated Apr 8, 1997

### Contents of Project: Tetris

CS596 Project

Design and implement a program to play the game Tetris. Your design should permit the following options to be "easily" added to your program: previewing the next block to appear in the pit before the current block has stopped; allowing other shapes for blocks; starting the game with random elements in the bottom of the pit; different size pits; allowing the user to define the rotate left, rotate right, move right, move left, and drop keys; and allowing the player to flip a block (two shapes come in left and right hand versions, which can not be rotated into each other). The options need not be implemented.
Tetris
In the center of the game is a rectangular shaped pit, 10 units wide, 20 units high. Oddly-shaped blocks appear at the top of the pit. The shapes, shown bellow, are all combinations of connected four 1*1-cells. The block falls to the bottom of the bit. When the block reaches the bottom of the pit it stops moving and a new block appears at the top. While a block drops, it may be rotated left, rotated right, moved left a column(s) or moved right a column(s). There is a drop key that instantaneously moves a block from its current position straight down. This saves time and one point is scored for each row a block is dropped in this fashion. The goal of the game is to arrange blocks so that they completely fill the horizontal rows of the pit. When a horizontal row is completely filled with no gaps, it will disappear and the blocks in the rows above will drop down to take their place. When a row fills the player scores 100 points. If 2 rows fill at the same time, the player scores 300 points. If 3 (4)rows fill at the same time, the player scores 600 (1000) points. The game ends when no more blocks can be added to the pit. After 10 rows have been filled, the next level of play is reached. The rate at which blocks fall increases with each level.
Block Shapes