Skip to content

tmthyngyn/2048-tkinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

2048 — Tkinter

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).

Features

  • 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

Architecture

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

Running

Requires Python 3.9+ (uses modern type hints like list[list[Optional[int]]]).

python3 main.py

Files

  • main.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

Author

Timothy Nguyen — github.com/tmthyngyn

About

Tkinter implementation of the 2048 tile-merging game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages