Problem statement
Design the object model and core APIs for a falling-block game engine: tetromino shapes descend on a grid, the player shifts and rotates them, full rows clear, and the game ends when the stack tops out.
Operating context. A playfield grid (default 10 wide by 20 tall) and seven tetromino types. A gravity tick moves the active piece down one row; the player can shift it left or right, soft-drop, hard-drop, and rotate (with a wall-kick nudge). When a piece can no longer fall it locks into the field, any full rows clear and the rows above shift down, and scoring rewards cleared lines. Upcoming pieces come from a seven-bag randomizer, and the game ends when a freshly spawned piece immediately collides. Single in-process session driven by an injected tick clock.
Out of scope. Rendering, animation, and input-device handling, hold-piece and combo-scoring variants beyond a rule seam, networked play and leaderboard persistence, and sound.
What to produce. The class model (field, tetromino, cell, game, piece queue/bag, scoring rule, clock), the public API each exposes, and how a piece's occupied cells and rotation states are represented. Be explicit about how collision and lock are detected without scanning the whole field, how the clock and randomizer are injected for deterministic tests, how a new shape or scoring rule is added without touching the movement engine, and how spawn/game-over is a total transition.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Oop Solid
- Patterns Strategy
- Patterns State
- Domain Games