brackt/app/services/simulations
Claude d4df0b65fb
Make LLWS simulator bracket-aware and calibrate its futures model
The LLWS simulator was overestimating favorites and ignoring games that had
already been played. Two separate causes:

1. Championship futures were used directly as single-game strength
   (p1 / (p1 + p2)). A future already compounds the ~6 wins needed to take
   the title, so this made every individual game as lopsided as the whole
   tournament and re-compounded that edge round after round. Against a
   representative 20-team board the favorite priced at 21.8% simulated at
   44.9%, and the longest shot fell to ~0%.

   Futures are now decompressed to single-game Elo via convertFuturesToElo,
   the same pipeline the other bracket simulators use, and games are played
   with eloWinProbabilityWithParity. The parity factor was calibrated by
   sweeping it until a randomized-draw simulation reproduces the board it
   was fed: at 1000 the favorite simulates at 21.8% and field-wide RMSE
   drops from 0.062 to 0.003. It is overridable per season via config.

2. The simulator never read playoff_matches, so it re-ran the tournament
   from an empty bracket every time and shuffled the draw at random each
   iteration. A recorded loss changed nothing.

   It now loads the seeded llws_20 bracket, places teams in their real
   slots, and replays completed games from their recorded result instead of
   re-simulating them, so an eliminated team correctly drops to zero. When
   no bracket exists (or it has no participants seeded) it falls back to the
   previous randomized-draw behavior, and a seeded bracket is authoritative
   about which side a team is on, so externalId is only required on the
   pre-bracket path.

Guards: a recorded result is only honored when its two participants are the
ones the simulation routed into that game, so a corrupt or out-of-order row
cannot desynchronize the rest of the bracket; brackets seeding an unknown or
duplicated participant now fail loudly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5vQZMPeokzfMqHQjq1RDZ
2026-08-21 21:09:47 +00:00
..
__tests__ Make LLWS simulator bracket-aware and calibrate its futures model 2026-08-21 21:09:47 +00:00
afl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
auto-racing-simulator.ts claude/indycar-ev-sims-probability-fpzfx6 (#139) 2026-08-17 22:50:35 +00:00
bracket-simulator.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
brackt-simulator.ts Add Brackt as a league-private meta-sport (#200) (#377) 2026-05-04 20:31:44 -07:00
college-hockey-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
config-access.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
cs-major-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
darts-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
epl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
golf-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
input-policy.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
llws-simulator.ts Make LLWS simulator bracket-aware and calibrate its futures model 2026-08-21 21:09:47 +00:00
manifest.ts Make LLWS simulator bracket-aware and calibrate its futures model 2026-08-21 21:09:47 +00:00
mlb-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
mls-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
nba-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ncaa-basketball-simulator.ts Upgrade NCAA preseason simulators (#419) 2026-05-12 22:26:25 -07:00
ncaa-football-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ncaam-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ncaaw-simulator.ts Fix NCAAW futures odds simulation and admin import UX (#420) 2026-05-13 01:06:16 -07:00
nfl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
nhl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
nll-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
race-points.ts claude/indycar-ev-sims-probability-fpzfx6 (#139) 2026-08-17 22:50:35 +00:00
registry.ts Make LLWS simulator bracket-aware and calibrate its futures model 2026-08-21 21:09:47 +00:00
runner.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
shared-major.ts Unify majors: score once, fan out across windows + tennis bracket EV 2026-06-22 20:32:22 -07:00
simulation-probabilities.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
simulator-config.ts Add MLS sport simulator (mls_bracket) (#422) 2026-05-14 12:45:53 -07:00
snooker-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
soccer-helpers.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
tennis-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
types.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
ucl-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
wnba-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00
world-cup-simulator.ts claude/probability-config-review-1tdolw (#119) 2026-06-30 23:24:48 +00:00