AlgoMaster Logo

Design Tetris Game

Last Updated: July 11, 2025

Ashish

Ashish Pratap Singh

4 min read

Tetris is a classic tile-matching puzzle game where players control falling shapes, called tetrominoes, and arrange them on a fixed-size vertical grid. The objective is to form complete horizontal lines without gaps.

Tetris

Key game mechanics include:

  • Tetrominoes falling at a constant or increasing speed
  • Player-controlled movement (left, right, down) and rotation
  • Collision detection to prevent overlapping or going out of bounds
  • Clearing full lines, which increases the player’s score and creates more space
  • Ending the game when new blocks can no longer be placed

In this chapter, we will explore the low-level design of Tetris game in detail.

Let's start by clarifying the requirements:

1. Clarifying Requirements

Before starting the design, it's important to ask thoughtful questions to uncover hidden assumptions, clarify ambiguities, and define the system's scope more precisely.

Here is an example of how a conversation between the candidate and the interviewer might unfold:

After gathering the details, we can summarize the key system requirements.

1.1 Functional Requirements

  • The game is played on a 10x20 grid
  • Support all 7 standard Tetris tetrominoes (I, O, T, S, Z, J, L)
  • Allow tetromino movement: left, right, and down (soft drop)
  • Allow rotation of tetrominoes (clockwise; counterclockwise is optional)
  • Automatically drop pieces at a fixed interval, which decreases with level progression
  • Clear any fully filled row and shift the rows above downward
  • Track and display player score and level
  • End the game when new tetrominoes cannot be placed due to filled cells

1.2 Non-Functional Requirements

  • Modularity: The game should be composed of well-separated components
  • Extensibility: The design should be extensible to support future features
  • Maintainability: The codebase should follow object-oriented principles and be easy to test, extend, and debug
  • User Feedback: The game should display real-time score, level, next piece preview, and game over messages clearly in the console

2. Identifying Core Entities

Premium Content

This content is for premium members only.