feat(robot): occasional off-strategy deviation, strict in the endgame #69
Reference in New Issue
Block a user
Delete Branch "feature/ai-strategy-deviation"
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?
What
The honest/disguised robot followed its per-game
playToWin/lose intent on everymove, making the outcome too predictable. It now flips that intent for a single move
on ~20% of opening/midgame turns (a winning robot eases off, a losing one surges
ahead), so the chosen strategy may not pan out — which favours the human.
The deviation chance tapers linearly to 0 over the last 14 tiles in the bag and is
0 once the bag is empty, so the endgame follows the chosen strategy strictly.
How
deviateProb(bagLen)/deviates(seed, moveCount, bagLen)inrobot/strategy.go—deterministic per-turn draw (
mix(seed,"deviate",moveCount)), reproducible acrossrestarts like the rest of the seed-derived behaviour.
act()flipsplayToWin(seed)for the move whendeviatesfires, before the existingselectMove— so it reuses the margin-band logic and applies to both robot paths.selectMovestays a pure function of its inputs; the per-game intent (admin card) isunchanged.
Tests
robotunit: taper bounds + monotonicity, never-in-endgame, determinism, ~20% rate.Local gate green:
gofmt/vet/build, all backend unit tests, full backendintegration suite (CI parity,
inttestincl. the AI-game tests).Docs (same PR)
docs/ARCHITECTURE.md§7,docs/FUNCTIONAL.md(+_ru),backend/README.md,PRERELEASE.md(AI follow-up),PLAN.mdStage 5.