Design and implement core Tetris game logic

Quick Overview

This question evaluates practical implementation skills in game logic, real-time state and event management, piece rotation and movement handling, line-clearing algorithms, and clean, testable code organization.

Design and implement core Tetris game logic

Company: Liftoff

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Implement the core logic of the Tetris game in a way that can run in a terminal (no graphical UI required). Requirements: - Board/grid: standard size `width = 10`, `height = 20`. - Pieces: the 7 tetrominoes `I, O, T, S, Z, J, L`. - Support piece rotation, left/right movement, soft drop, hard drop. - Gravity: the active piece moves down periodically; when it can’t move down, it locks into the board. - Line clears: when a row is full, remove it and shift rows above down. - End condition: game over when a new piece cannot be spawned. Deliverable: - A cleanly structured implementation with a simple terminal loop (text rendering is fine) or an API that a terminal loop can call. - Emphasis on correctness and code organization (testability), not fancy UI. Clarifications you may decide and document: - Rotation system (e.g., simple wall kicks vs none) - Scoring rules (can be simplified) - Random piece generation (e.g., 7-bag vs uniform random)

Quick Answer: This question evaluates practical implementation skills in game logic, real-time state and event management, piece rotation and movement handling, line-clearing algorithms, and clean, testable code organization.

|Home/Software Engineering Fundamentals/Liftoff
Liftoff logo
Liftoff
Feb 26, 2026, 12:00 AM
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
5
0

Implement the core logic of the Tetris game in a way that can run in a terminal (no graphical UI required).

Requirements:

  • Board/grid: standard size width = 10 , height = 20 .
  • Pieces: the 7 tetrominoes I, O, T, S, Z, J, L .
  • Support piece rotation, left/right movement, soft drop, hard drop.
  • Gravity: the active piece moves down periodically; when it can’t move down, it locks into the board.
  • Line clears: when a row is full, remove it and shift rows above down.
  • End condition: game over when a new piece cannot be spawned.

Deliverable:

  • A cleanly structured implementation with a simple terminal loop (text rendering is fine) or an API that a terminal loop can call.
  • Emphasis on correctness and code organization (testability), not fancy UI.

Clarifications you may decide and document:

  • Rotation system (e.g., simple wall kicks vs none)
  • Scoring rules (can be simplified)
  • Random piece generation (e.g., 7-bag vs uniform random)
Loading comments...