# 🎰 TONGO CORE

Tongo Core is the Star Trek-inspired live simulation and probability engine powering **Quark's Holo-Grid Ledger**. It operates as a background daemon, simulating active space-grid combat, generating random in-play events, recalculating live market odds, and writing JSON telemetry directly to Valkey for client-side consumption.

---

## 🏛 Architecture: Onion Clean Architecture

The engine uses a strict clean architecture (onion pattern) with clean separation between layers:

- **Domain Layer (`internal/domain/`)**: Pure domain models (`entity/`) and output/input interface definitions (`port/`). Free of external frameworks or dependencies.
- **Application Layer (`internal/application/`)**: Application services coordinating domain logic (match scheduling, combat resolution, probability calculation, markets).
- **Infrastructure Layer (`internal/infrastructure/`)**: Concrete implementations of ports (Valkey adapter, YAML loader, Viper config).

---

## 🚀 Getting Started

### Prerequisites

- Go 1.23+
- Valkey or Redis running on port 6379

### Commands

Run using the `Makefile`:

```bash
# Build the binary
make build

# Run the simulation daemon
make run

# Validate taxonomy config
make validate

# Run tests
make test
```

### CLI Interface

Direct CLI commands:
- `tongo serve`: Start the simulation engine daemon.
- `tongo validate`: Parse and check structure of `taxonomy.yaml`.
- `tongo version`: Display current version.
