Route model learns from bot runs; Thompson sampling in the advisor (work in progress)

- planner/policy.yaml: which sources the route model learns from (spreadsheet,
  reported, bot) and the low-bias sample
- bot runs: deaths coded by stage, Malek intent for runs with a target
- model: survival of the first dragon is not counted when nothing after it is
  known; the meadow dragon falls back to what the bot saw
- solver.js: advisor(..., {sampling: "thompson", seed, draws}) follows one
  posterior draw per attempt and reports each pick's propensity

Not shipped yet: mixing sources lowers the fitted shrinkage for the shadow roll
(alpha 500 -> 50 in the low-bias sample), see the conversation of 2026-11-09.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-10 02:29:09 +00:00
co-authored by Claude Opus 5.5
parent d37eaa3378
commit c0355616b6
6 changed files with 121 additions and 22 deletions
+15
View File
@@ -110,3 +110,18 @@ test("solverHistory turns form variables into a history keyed by the game's step
assert.strictEqual(l.leave, "Leave them");
assert.strictEqual(l.red, "Let it pass (two Greens)");
});
test("Thompson sampling: one posterior draw per seed, with the chance of each pick", () => {
const S = require("../../core/solver.js");
const P = require("../../data/public/policy.json");
const best = S.advisor(P.samples.all, "Blue", "eventually").next({});
assert.strictEqual(best.propensity, 1);
const a = S.advisor(P.samples.all, "Blue", "eventually", { sampling: "thompson", seed: 3, draws: 8 });
const b = S.advisor(P.samples.all, "Blue", "eventually", { sampling: "thompson", seed: 3, draws: 8 });
const ra = a.next({}), rb = b.next({});
assert.strictEqual(ra.choice, rb.choice); // same seed, same draw
assert.ok(ra.propensity >= 0 && ra.propensity <= 1);
const picks = new Set();
for (let s = 1; s <= 12; s++) picks.add(S.advisor(P.samples.all, "Blue", "eventually", { sampling: "thompson", seed: s, draws: 1 }).next({}).choice);
assert.ok(picks.size > 1, "different seeds explore different options");
});