# Py2048 - Terminal 2048 Game

A Python implementation of the classic 2048 puzzle game that runs in your terminal with colorful output!

## Features

- 🎮 Classic 2048 gameplay
- 🌈 Colorful terminal output
- ⌨️ Keyboard controls (WASD or arrow keys)
- 📊 Score tracking
- 🏆 Win detection (reach 2048!)
- 💻 Cross-platform (Windows, Mac, Linux)

## Installation

```bash
pip install py2048-game
```

## How to Play

After installation, start the game with:

```bash
py2048
# or
2048
```

### Controls

| Key | Action |
|-----|--------|
| W / ↑ | Move Up |
| S / ↓ | Move Down |
| A / ← | Move Left |
| D / → | Move Right |
| Q | Quit |
| N | New Game |
| H | Help |

### Objective

Combine tiles with the same number to reach **2048**!

- Use arrow keys or WASD to move all tiles
- When two tiles with the same number touch, they merge into one
- After each move, a new tile (2 or 4) appears in a random empty spot
- The game ends when you can't make any more moves

## Play in Python

You can also use the game as a library:

```python
from py2048 import Game2048

# Create a new game
game = Game2048()

# Make moves
game.move_up()
game.move_down()
game.move_left()
game.move_right()

# Check game state
print(game.get_score())
print(game.has_won())
print(game.is_game_over())

# Print the grid
print(game)
```

## Screenshots

```
==============================
         2048 GAME
==============================

+------+------+------+------+
|      |  2   |      |      |
+------+------+------+------+
|      |  4   |  2   |      |
+------+------+------+------+
|  2   |  16  |  4   |  2   |
+------+------+------+------+
|  4   |  32  |  8   |  4   |
+------+------+------+------+
```

## Requirements

- Python 3.6 or higher

## License

MIT License - feel free to use and modify!

## Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

## Credits

Inspired by the original [2048 game](https://github.com/gabrielecirulli/2048) by Gabriele Cirulli.
