Implement runBattle() orchestrator #130
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Wayfinder child of: #126
Wire together server manager + bot compiler/launcher + result parser into the single
runBattle()API call. Handle the full lifecycle: ensure server is up, compile bots, generate bot JSON configs (with InitialPosition if specified), start battle, wait for completion, parse results, return BattleResult.Blocked by: #127, #128, #129
Grilling Revisions
Server connection:
BattleRunnerconnects to external server viaserverUrl("ws://localhost:PORT").BotEntry.of(directory)works in external mode — Booter launches bots locally.API parameters:
bots: seq[string]— paths to .nim source filesrounds: int— number of rounds (default 1)initialPositions: Table[string, InitialPosition]— optional per-bot positions (keyed by source path)timeout: Duration— default timeout, kills battle on expiryoutputFlags: seq[string]— raw passthrough to Java runner (@["--positions", "--scanned"]etc.)Process model:
startProcessfor server (long-lived singleton),execCmdExfor runner (blocking, captures stdout+exitcode). Stdout parsed into BattleResult, stderr passes through to terminal.Spec additions from grilling
runBattle()must usedeferblocks to clean up bot processes and BattleRunner process on any exception.runBattle()call.Dependency addition
Blocked by: #127, #128, #129, #134 (adding #134 — BattleRunner process lifecycle must be implemented before the orchestrator can wire it in).
Implemented in commit
57a1915.