2048 TUI Game

January 3, 2026 · View on GitHub

A terminal-based implementation of the classic 2048 puzzle game using Python and curses.

Python Version License

Installation

pip install tui-2048

From source

git clone https://github.com/ps06756/tui-2048.git
cd tui-2048
pip install .

Development install

pip install -e .

Usage

After installation, run the game with:

tui-2048

Or alternatively:

2048

Or run directly with Python:

python -m game2048.cli

Controls

KeyAction
↑ / WMove tiles up
↓ / SMove tiles down
← / AMove tiles left
→ / DMove tiles right
RRestart game
QQuit game

Game Rules

  1. Use arrow keys or WASD to slide all tiles in a direction
  2. Tiles with the same number merge into one when they collide
  3. Each move spawns a new tile (2 or 4) in an empty spot
  4. Combine tiles to reach 2048 and win!
  5. Game ends when no moves are possible

Features

  • Colorful terminal UI matching the original 2048 style
  • 256-color support (with fallback for basic terminals)
  • Score and best score tracking
  • Works on Linux, macOS, and Windows (with WSL)

Requirements

  • Python 3.7+
  • A terminal that supports curses (most Unix terminals, Windows Terminal with WSL)

Project Structure

tui-2048/
├── pyproject.toml       # Package configuration
├── LICENSE              # MIT License
├── README.md            # This file
├── main.py              # Alternative entry point
└── game2048/
    ├── __init__.py      # Package exports & version
    ├── cli.py           # CLI entry point
    ├── game.py          # Core game logic
    └── tui.py           # Terminal UI rendering

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.