project
Games: Tetris & Snake
Two classic games built with an emphasis on functional programming principles and immutable game state design. Rather than mutating the game grid directly, each step produces a new game state from the previous one, keeping the logic predictable and side-effect free.
The Tetris implementation handles tetromino movement, rotation, hard drops, and line clearing. Rotation logic is modeled through an abstract class hierarchy — each of the three distinct rotation behaviors is implemented as a subclass, keeping the mechanics clean and extensible.
The Snake implementation covers movement, growth mechanics, screen wrapping, and collision detection. Apple placement uses a deterministic free-cell indexing strategy — numbering all unoccupied cells and selecting one with a single random call — ensuring reproducible behavior.
The game was later extended with a rewind mode, allowing the player to step back through previous game states. Both projects made extensive use of higher-order functions such as map, filter, and forall.