TetriSDL
Uni Coursework - First Year (67/70)
- Tech Stack: C, SDL
In first year, I implemented the modern Tetris engine in C with the SDL library. In theory, other developers should be able to use the functions that I provide to create new game modes (such as Sprint - clearing 40 lines as quick as possible, or Marathon - no time limit, only uses when the top of the board is reached).
The trickiest part in the modern Tetris engine is the Super Rotation System (SRS). This enables very unintuitive looking rotations that do not seem possible, but is in fact a core part of modern Tetris (such as building T-spin cannons, or wall kicks).
The engine uses the 7-bag random pieces (all 7 tetriminos are given in random order before the next "bag" of 7 tetriminos). The next / hold functionalities are implemented. It also detects T-spins, back-to-backs, and the less impressive 1-4 line clears.
All functionalities also have unit tests. The initial board is loaded from a file, then actions are issued, and outcome (resulting board, score) are checked against the expected values.