27 lines
928 B
TypeScript
27 lines
928 B
TypeScript
import { NCAABasketballSimulator } from "./ncaa-basketball-simulator";
|
|
import type { Simulator, SimulationResult } from "./types";
|
|
|
|
/**
|
|
* NCAAW neutral-court win probability using a Barthag-style Log5 formula.
|
|
* Ratings are season-scoped simulator inputs, not hardcoded data.
|
|
*/
|
|
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 {
|
|
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);
|
|
}
|
|
}
|