feat(snake): add adaptive adversarial search

- Share duel search contexts and transpositions across candidate moves.
- Add aspiration windows, principal variation ordering, and body caches.
- Model simultaneous multiplayer responses with a compact beam rollout.
- Adapt search depth and response breadth to the remaining deadline.
- Add a deterministic arena benchmark with optional JSON reporting.
- Expose search metrics, document benchmarking, and bump Prism to 1.2.0.
This commit is contained in:
2026-08-01 19:26:19 +02:00
parent 6643eb35af
commit cb6c8d4dc8
9 changed files with 604 additions and 46 deletions
+17 -3
View File
@@ -68,9 +68,12 @@ Allowed values: `safe`, `balanced`, `aggressive`.
## PrismBattleSnake_GPT_5_6_Sol
`PrismBattleSnake_GPT_5_6_Sol` is a separate snake that keeps Apex's strategy while
accelerating hot spatial operations with a Python-integer bitboard engine. Its
filename, class, and registry key include the model name, while its public
Battlesnake API name remains `PrismBattleSnake`.
accelerating hot spatial operations with a Python-integer bitboard engine. It
also shares duel transpositions across candidate moves, uses principal-variation
ordering and aspiration windows, and runs a compact adversarial multiplayer
rollout with simultaneous enemy responses. Its filename, class, and registry
key include the model name, while its public Battlesnake API name remains
`PrismBattleSnake`.
Run it with:
```sh
@@ -87,6 +90,17 @@ python scripts/benchmark_snakes_from_db.py \
The benchmark opens SQLite read-only and reports mean, median, p95, and maximum
move latency. Increase `--samples` for a broader but slower comparison.
Run the deterministic CI-friendly arena benchmark without a gameplay database:
```sh
just bench-snake-arena positions=100
```
It reports latency, reached minimax depth, and move disagreements between Apex
and Prism. Add `output=data/arena-report.json` to save a machine-readable report.
For representative strategy evaluation, provide recorded positions to
`scripts/benchmark_snake_arena.py --database /path/to/gameplay.sqlite3`, then run
paired seeded games with the local Battlesnake CLI to measure win rate.
## Compact gameplay database
New gameplay turns use normalized storage: the turn row stores food, hazards,
move, and thinking data once; snake identity is stored once per game in