Metadata-Version: 2.4
Name: triple-triad-ff8
Version: 0.1.3
Summary: A fan-made tribute to the Triple Triad card game from Final Fantasy VIII
Project-URL: Homepage, https://github.com/fernando24164/triple-triad-ff8
Author-email: fernando24164 <fernando24164@gmail.com>
License: MIT License
        
        Copyright (c) 2025 fernando24164
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        ─────────────────────────────────────────────────────────────
        
        THIRD-PARTY INTELLECTUAL PROPERTY NOTICE
        
        "Final Fantasy", "Final Fantasy VIII", "Triple Triad", and all associated
        character names, card names, creature names, and game mechanics are
        trademarks and/or copyrighted material of Square Enix Holdings Co., Ltd.
        All rights reserved.
        
        This project is an unofficial, non-commercial fan work. It is not
        affiliated with, endorsed by, or sponsored by Square Enix. All
        Square Enix intellectual property is used here under fair use for
        the purpose of creating a fan-made tribute.
        
        The MIT License above applies solely to the original source code
        written by the author(s) of this project. It does not grant any
        rights to Square Enix's intellectual property.
License-File: LICENSE
License-File: NOTICE
Keywords: ff8,game,triple-triad
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Games/Entertainment
Requires-Python: >=3.13
Requires-Dist: numpy>=2.4.4
Requires-Dist: pygame>=2.6.1
Description-Content-Type: text/markdown

# Triple-triad

A terminal-based Python implementation of the classic **Triple Triad** card game from *Final Fantasy VIII*, complete with chiptune background music, smart AI opponents, and support for official rules like Same, Plus, and Open.

---

## ✨ Features

- **Authentic gameplay** — 110 cards from FFVIII
- **3 difficulty levels** — Easy, Medium, and Hard CPU opponents with distinct AI strategies
- **Optional rules** — Open, Same, Plus, and Random capture mechanics
- **Chiptune music** — Retro-style background music generated with NumPy and played through Pygame
- **Interactive deck builder** — Browse, filter, and sort all cards before picking your hand
- **Deck presets** — Themed decks (Fire Power, Ice Wall, Thunder Rush, and more)
- **Terminal rendering** — ANSI-colored board with card ownership indicators

---

## 🎮 How to Play

Triple Triad is a 2-player card game played on a 3×3 grid. Each player has 5 cards. Players take turns placing one card on the board. When a card is placed adjacent to an opponent's card, the touching sides are compared — if the attacker's value is higher, the defender's card is captured. The player with the most cards on the board at the end wins.

```
 ┌──────────────────┬──────────────────┬──────────────────┐
 │                  │                  │                  │
 │     [ 1 ]        │     [ 2 ]        │     [ 3 ]        │
 │                  │                  │                  │
 ├──────────────────┼──────────────────┼──────────────────┤
 │ ■Ifrit           │                  │                  │
 │      ▲ 9         │     [ 5 ]        │     [ 6 ]        │
 │ ◀ 5   Ice   8 ▶  │                  │                  │
 │      ▼ 6         │                  │                  │
 ├──────────────────┼──────────────────┼──────────────────┤
 │ □Shiva           │                  │                  │
 │      ▲ 6         │     [ 8 ]        │     [ 9 ]        │
 │ ◀ 6   Ice   9 ▶  │                  │                  │
 │      ▼ 7         │                  │                  │
 └──────────────────┴──────────────────┴──────────────────┘
```

- **■** = Your card
- **□** = CPU's card
- Numbers inside empty cells = board position (1–9)

---

## 🚀 Getting Started

### Prerequisites

- **Python 3.13+**
- **NumPy** (for audio synthesis)
- **Pygame** (for audio playback — optional, game runs silently without it)

### Installation

```bash
uv sync --locked
```

### Run the Game

```bash
python -m triple_triad.game
```

or

```bash
uv run triple-triad
```


## 🎵 Audio

The game includes a built-in chiptune soundtrack synthesized entirely in software:

- **5 channels**: melody, harmony, pad, bass, and percussion
- **Generated with NumPy** — no audio files required
- **Played through Pygame** — if Pygame is unavailable, the game runs silently

---

## 🧩 Rules

| Rule | Description |
|------|-------------|
| **Open** | CPU's hand is visible to the player |
| **Same** | If 2+ adjacent cards share equal values, all are captured |
| **Plus** | If 2+ adjacent cards share equal value *sums*, all are captured |
| **Random** | Cards are dealt randomly from the full pool |

---

## 🛠 Development

### Install Dev Dependencies

```bash
uv sync --locked
```

### Run Tests

```bash
uv run pytest
```

### Lint

```bash
uv run ruff check .
```

---

## 🤝 Contributing

Contributions are welcome! Here's how to get started:

1. **Fork** the repository
2. **Create a feature branch** — `git checkout -b feature/my-feature`
3. **Make your changes** — follow the existing code style
4. **Run tests** — `pytest`
5. **Submit a pull request**

Please open an issue first for major changes to discuss the approach.

---

## Build

```sh
uv build
```

```sh
twine upload dist/*
```

## 📄 License

This project is for educational and personal use. Triple Triad is a minigame from *Final Fantasy VIII*, © Square Enix. All card names and game mechanics are the property of their respective owners.