feat(robot): occasional off-strategy deviation, strict in the endgame
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Has been skipped
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s

The robot followed its per-game playToWin/lose intent on every move, which made
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 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.

The decision is deterministic from the seed (mix(seed,"deviate",moveCount)) and
applies to both robot paths via the shared selectMove; the per-game play-to-win
intent the admin card shows is unchanged. Adds deviateProb/deviates helpers and
unit tests (taper bounds + monotonicity, never-in-endgame, determinism, ~20%
distribution); bakes the behaviour into ARCHITECTURE §7, FUNCTIONAL (+_ru),
backend/README, PRERELEASE and PLAN Stage 5.
This commit is contained in:
Ilia Denisov
2026-06-15 21:37:23 +02:00
parent 9e6899bb7d
commit 3bceafbc12
9 changed files with 156 additions and 16 deletions
+8 -1
View File
@@ -407,7 +407,14 @@ English game the Latin pool.
(`engine.Candidates`) the move whose resulting lead (playing to win) or deficit
(playing to lose) is closest to a small band (**130 points**), rather than
always the maximum; with no legal play it exchanges a full rack when the bag can
refill it, else passes.
refill it, else passes. On **≈20%** of moves through the opening and midgame it
**deviates** — playing that single move toward the *opposite* band (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 per-game intent strictly. It is **deterministic from the seed**
(`mix(seed,"deviate",moveCount)`), a per-move wobble that leaves the per-game
play-to-win intent (and the admin card) unchanged.
- **Timing**: the per-move delay is **move-number-aware** — a right-skewed sample
(exponent k=4, short delays frequent) from a band that interpolates from
**[3, 10] min** at the first move to **[10, 90] min** by ~28 moves, so openings are