A fully playable Python implementation of the classic 2048 tile-merging puzzle game, built with tkinter.
Originally written as a coursework project for CSSE1001 — Introduction to Software Engineering at the University of Queensland (Semester 2, 2022).
- 4×4 grid with smooth tile-merge logic
- Score tracking
- Undo (up to 3 moves per game)
- Win detection (reaching the 2048 tile)
- Loss detection (no legal moves remaining)
- Restart prompt on win/loss
- Keyboard controls:
W/A/S/D
The codebase is structured around the classic Model–View–Controller split:
| Class | Responsibility |
|---|---|
Model |
Game state, move logic, undo history, win/loss detection |
GameGrid (tk.Canvas) |
Renders the tile grid |
StatusBar |
Displays score, undos remaining, and control buttons |
Game |
Wires the model to the view, handles input events, manages tile-spawn animation |
Requires Python 3.9+ (uses modern type hints like list[list[Optional[int]]]).
python3 main.pymain.py— game implementation (Model, View, Controller classes)a3_support.py— constants (colours, fonts, board dimensions, control bindings) — provided as course scaffolding by UQ CSSE1001 teaching staff
Timothy Nguyen — github.com/tmthyngyn