## Summary - **MLB simulator seeding now responds to projected wins**: replaced hardcoded FanGraphs `p_div`/`p_wc` probability draws with Binomial regular-season simulation. Admin-entered projected wins (via Elo) now drive both playoff _qualification_ odds and in-bracket game win probability, not just the latter. - **Reads current standings mid-season**: `getRegularSeasonStandings` is called so synced `wins`/`gamesPlayed` feed into each simulation iteration's projected final standings. - **27× seeding performance improvement**: `sampleBinomial` now uses a Box-Muller normal approximation for `n ≥ 30`, dropping the seeding phase from ~243M to ~3M `Math.random()` calls per 50K-sim run (pre-season, 162 remaining games × 30 teams). - **Missing-standings warning**: when standings exist for some teams but not all recognized ones (partial sync), a `logger.warn` now surfaces which teams are falling back to 0 wins / 162 remaining instead of silently distorting seeding. - **Cleanup**: `eloToRDif` calls `rawWinRateFromElo` instead of inlining the same formula. - **Simulate errors surface inline**: moved simulation action from dedicated route to parent page `intent="simulate"` so errors display inline rather than crashing to an error page. ## Test plan - [ ] `npm run test:run -- mlb-simulator` — 49 tests pass - [ ] `npm run typecheck` — clean - [ ] Trigger a simulation from the admin panel for an MLB season with projected wins entered; confirm teams with higher projected wins show meaningfully higher EVs - [ ] Confirm that running simulate with no projected wins entered (pre-season defaults) still produces a valid bracket - [ ] Check logs after simulating a season where some teams lack standings rows — confirm warning appears 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Chris Parsons <chrisparsons1127@gmail.com> Reviewed-on: #65 |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| simulations | ||
| standings-sync | ||
| bracket-simulator.ts | ||
| brackt.server.ts | ||
| discord.ts | ||
| draft-autostart.ts | ||
| draft-discord.server.ts | ||
| draft-email.server.ts | ||
| ev-calculator.ts | ||
| icm-calculator.ts | ||
| probability-engine.ts | ||
| probability-updater.ts | ||
| sync-tournament-results.ts | ||