PyTetris

Project Requirements

The goal of this project is to implement the Tetris video game in Python in teams of two or three students . Rules for the game are given below.

Your project must satisfy the following core requirements:

  1. You must design and implement a fully functional Tetris game including:
    1. moving and rotating pieces
    2. allowing only legal moves
    3. detecting when the game is over
  2. Your project must use a graphical user interface (GUI) for game playing. (We will provide lots of it, which you will modify.)
  3. You must implement 8 classes, one per piece type plus one for the playing board. You will be required to use an object-oriented design. 
  4. All team members must contribute to and understand their project.

Most of the work on your project will be translating the rules provided into a functional design and implementation. If you are having trouble planning or getting started, get help. It is much better (and easier) to get help early and start with a good plan than to try to hack a poor design into a semi-functional program in the final days before the project is due.

Milestones

To make sure that you are on-track to complete your project, you must meet the following milestones. Each milestone will contribute to your overall project grade. Each milestone must be completed before starting the next.

Grading

Project grades will be based on both individual and group results. We will grade each project milestone, plus the final project program. Grading will include both the proper functioning of your program and an evaluation of your design, coding style, and documentation (including SVN commit messages). The grade will also depend heavily on what enhancements you add (see below).

Each team member will be required to complete an evaluation survey about his or her own performance and that of each of his or her teammates. We will use these surveys and our own observations to assign individual project grades.

About Tetris

Overview

Tetris is a one-player game in which pieces of various shapes fall from the top of the board, one at a time. The player can rotate the falling piece clockwise, move it left or right as it falls, or cause it to drop, until it stops by hitting a stationary piece. Once it does, a new piece starts to fall. The goal of the game is to position the pieces so that complete rows (lines) are filled with pieces. This causes the row(s) to disappear, the rest of the pieces above it(them) to fall, and points to be scored. Play continues until there is at least one stationary piece at the top row of the board. The following picture is taken from the solutions of a team of students.

There is an interesting discussion of the history of Tetris here.

Rules

Terminology

Piece Types

There are 7 different pieces of various shapes. Note that each has the same area (4 cells).  Pictured are:

The centroid of each piece is marked with a dot. We use this centroid to mark the position of the piece. Also, each pieces rotates around this point (except MrChunky, who doesn't rotate). Note that each piece, depicted above, is shown in its default orientation, that is, the orientation in which it starts at the top of the playing board.

Initial Game Setup

Game Play

In each time step:

To get a feel for game play, please play the basic solution we provide.

Suggestions

Enhancements

Once you are done with the basic version, you will be required to add some enhancements. You will earn a higher grade for doing more challenging ones, and the more, the better. Here are some suggestions, to get you thinking.

[ home ]