Add Monte Carlo simulator, game metrics and sim CLI (Phase 5)

`dojo sim` plays seeded games over a scenario matrix (variant, players,
Kiai bonus, start position, bot lineup) in parallel, prints a summary per
scenario and optionally writes one CSV row per game. Metrics are replayed
from the event log. Plan updated with the Phase 5 baseline.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 16:29:22 +02:00
parent 0aaf113fc3
commit 7b76b10175
9 changed files with 719 additions and 12 deletions
+17
View File
@@ -32,6 +32,23 @@ uv run dojo board validate --quadrant other.txt --legend other.toml # check an
`validate` exits with `0` when the board is fine (warnings allowed), `1` on rule violations,
`2` when the file is malformed or missing.
## Simulation
Plays many seeded games with bots and prints metrics per scenario. Every combination of the
listed values is a scenario; game `i` of each scenario uses seed `--seed + i`, and the lineup
rotates one seat per game. Bots: `random`, `balanced`, `farmer`, `aggressive`.
```sh
uv run dojo sim # variants A and B, 4 players, 200 games each
uv run dojo sim --games 1000 --csv games.csv # more games; one CSV row per game
uv run dojo sim --variant B --players 3 4 6 8 --start 0 3 # player counts x start position
uv run dojo sim --kiai 2 1 # Kiai +2 vs +1
uv run dojo sim --lineup balanced,random balanced # several lineups (comma-separated seats)
uv run dojo sim --seed 42 --jobs 1 # other dice; single process
```
Minutes are estimated as 45 s per turn plus 30 s per Kumite.
## Development
```sh