2048 TUI Game
January 3, 2026 · View on GitHub
A terminal-based implementation of the classic 2048 puzzle game using Python and curses.
Installation
From PyPI (recommended)
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
| Key | Action |
|---|---|
| ↑ / W | Move tiles up |
| ↓ / S | Move tiles down |
| ← / A | Move tiles left |
| → / D | Move tiles right |
| R | Restart game |
| Q | Quit game |
Game Rules
- Use arrow keys or WASD to slide all tiles in a direction
- Tiles with the same number merge into one when they collide
- Each move spawns a new tile (2 or 4) in an empty spot
- Combine tiles to reach 2048 and win!
- 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.