2026-05-12 22:26:25 -07:00
|
|
|
import { NCAABasketballSimulator } from "./ncaa-basketball-simulator";
|
Add NCAAM and NCAAW bracket Monte Carlo simulators (#150)
- NCAAM: KenPom AEM logistic formula (1/(1+exp(-diff/7.5))), data through 2025-26 March 15
- NCAAW: Barttorvik Barthag Log5 formula (A*(1-B)/(A*(1-B)+B*(1-A))), same bracket structure
- Both simulators: 50,000-iteration Monte Carlo, First Four simulation, honors completed matches
- Track E8+ placements only: champion, finalist, FF losers (3rd/4th), E8 losers (5th–8th)
- Add bracket configuration validation: null R64 slots must exactly match First Four mapping
- Fix DEFAULT_SCORING_RULES to 100/70/45/45/20/20/20/20 (3rd/4th=45, 5th–8th=20)
- Align scoring constants across simulate route, expected-values display, and server action
- Zero out EVs for non-bracket participants on every simulation run (prevents EV inflation)
- Add EV total invariant warning (expected ~340) on expected-values admin page
- 98 unit tests across NCAAM, NCAAW, and UCL simulators — all passing
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 23:31:47 -07:00
|
|
|
import type { Simulator, SimulationResult } from "./types";
|
|
|
|
|
|
|
|
|
|
export function barthagWinProbability(barthagA: number, barthagB: number): number {
|
|
|
|
|
const pA = barthagA * (1 - barthagB);
|
|
|
|
|
const pB = barthagB * (1 - barthagA);
|
|
|
|
|
const total = pA + pB;
|
|
|
|
|
if (total === 0) return 0.5;
|
|
|
|
|
return pA / total;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class NCAAWSimulator implements Simulator {
|
2026-05-12 22:26:25 -07:00
|
|
|
private readonly simulator = new NCAABasketballSimulator({
|
|
|
|
|
source: "ncaaw_bracket_rating",
|
|
|
|
|
missingRatingName: "Barthag-like rating",
|
|
|
|
|
selectionRatingDivisor: 0.08,
|
|
|
|
|
winProbability: barthagWinProbability,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
simulate(sportsSeasonId: string): Promise<SimulationResult[]> {
|
|
|
|
|
return this.simulator.simulate(sportsSeasonId);
|
Add NCAAM and NCAAW bracket Monte Carlo simulators (#150)
- NCAAM: KenPom AEM logistic formula (1/(1+exp(-diff/7.5))), data through 2025-26 March 15
- NCAAW: Barttorvik Barthag Log5 formula (A*(1-B)/(A*(1-B)+B*(1-A))), same bracket structure
- Both simulators: 50,000-iteration Monte Carlo, First Four simulation, honors completed matches
- Track E8+ placements only: champion, finalist, FF losers (3rd/4th), E8 losers (5th–8th)
- Add bracket configuration validation: null R64 slots must exactly match First Four mapping
- Fix DEFAULT_SCORING_RULES to 100/70/45/45/20/20/20/20 (3rd/4th=45, 5th–8th=20)
- Align scoring constants across simulate route, expected-values display, and server action
- Zero out EVs for non-bracket participants on every simulation run (prevents EV inflation)
- Add EV total invariant warning (expected ~340) on expected-values admin page
- 98 unit tests across NCAAM, NCAAW, and UCL simulators — all passing
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 23:31:47 -07:00
|
|
|
}
|
|
|
|
|
}
|