Tetris For Intro/Intermediate Programmers (Summer 2018 update)

David Kosbie
Carnegie Mellon University
koz@cmu.edu

Abstract

These notes are an updated version of this original version. They are designed for intro/intermediate programmers (specifically, students who have completed about 1-2 weeks of summer 15-112 at CMU).

Note that this design for Tetris is somewhat simplified, though the end result is indeed a reasonably functional game of Tetris. Also, the techniques used to create this game can be used to create many other popular arcade games.

Have fun!

Contents

  1. Prerequisites (Python, Tkinter, Event-Based Animations, and Time-Based Animations)
  2. Building Tetris
    1. Design Overview
    2. Creating and Drawing the board
    3. Creating and Drawing the fallingPiece
    4. Moving the fallingPiece left/right/down
    5. Rotating the fallingPiece
    6. Dropping and Placing the fallingPiece and Handling Game-Over
    7. Removing Full Rows and Keeping Score
    8. More Ideas