Metadata-Version: 2.4
Name: ti4-rules-engine
Version: 0.1.0
Summary: A Pythonic, structured data engine for Twilight Imperium 4th Edition
License: MIT License
        
        Copyright (c) 2026 Adam B
        
        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.
License-File: LICENSE
Requires-Python: >=3.14
Requires-Dist: pydantic>=2.0
Requires-Dist: structlog>=24.0
Requires-Dist: transitions>=0.9
Provides-Extra: api
Requires-Dist: fastapi>=0.110; extra == 'api'
Requires-Dist: uvicorn[standard]>=0.29; extra == 'api'
Provides-Extra: dev
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# TI4 Rules Engine

A Pythonic, structured data engine for Twilight Imperium 4th Edition. Tracks
game state, provides rule references, and calculates player options from a live
[AsyncTI4](https://github.com/AsyncTI4/TI4_map_generator_bot) Discord bot game.

## Analyse a game in one command

No installation required — just `uvx`:

```bash
uvx --from ti4-rules-engine ti4-analyze <game_name>
```

Replace `<game_name>` with the name of your AsyncTI4 game (the identifier shown
by the bot, e.g. `pbd22295`):

```
uvx --from ti4-rules-engine ti4-analyze pbd22295
```

The command fetches the live game snapshot from the AsyncTI4 API and prints:

- Current round, phase, and active player
- Per-player summary: faction, VP, resources, planets, technologies, and leaders
- Every legal action available to each player under TI4 rules right now
- Reachable systems for each fleet (movement + anomaly rules applied)

> **Note:** `uvx --from ti4-rules-engine` requires the package to be published
> on PyPI.  Until then, clone the repo and use the local install instead:
>
> ```bash
> git clone https://github.com/adam133/ti4-rules-engine
> cd ti4-rules-engine
> uv tool install .
> ti4-analyze pbd22295
> ```

### What it shows

```
============================================================
Game:   pbd22295   Round: 3   Phase: action
Active: sargun
============================================================

  sargun [ACTIVE]
    Faction:  Nekro Virus
    VP:       5
    TG:       3  |  Commodities: 0
    Tokens:   3 tactical / 5 fleet / 2 strategy
    Planets:  8 controlled, 2 exhausted
    ...
    Actions available:
      • tactical_action
      • component_action
      • strategic_action
```

## Further reading

- **[docs/implementation.md](docs/implementation.md)** — module reference and
  API examples (game session setup, modifier system, combat simulation, scoring,
  movement, opponent public info)
- **[docs/contributing.md](docs/contributing.md)** — local dev setup, running
  tests, and project roadmap
