2026-03-09 15:34:31 -07:00
|
|
|
/**
|
|
|
|
|
* Simulator Registry
|
|
|
|
|
*
|
|
|
|
|
* Maps a sport's simulatorType to the appropriate Simulator implementation.
|
|
|
|
|
* Set simulatorType on the sport record in the admin UI.
|
|
|
|
|
* Add new simulators here as new sports are supported.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import type { Simulator } from "./types";
|
|
|
|
|
import { BracketSimulator } from "./bracket-simulator";
|
|
|
|
|
import { F1Simulator } from "./f1-simulator";
|
|
|
|
|
import { GolfSimulator } from "./golf-simulator";
|
2026-03-10 23:04:51 -07:00
|
|
|
import { UCLSimulator } from "./ucl-simulator";
|
2026-03-09 15:34:31 -07:00
|
|
|
|
|
|
|
|
export type SimulatorType =
|
|
|
|
|
| "f1_standings"
|
|
|
|
|
| "indycar_standings"
|
|
|
|
|
| "golf_qualifying_points"
|
2026-03-10 23:04:51 -07:00
|
|
|
| "playoff_bracket"
|
|
|
|
|
| "ucl_bracket";
|
2026-03-09 15:34:31 -07:00
|
|
|
|
|
|
|
|
export interface SimulatorInfo {
|
|
|
|
|
name: string;
|
|
|
|
|
description: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const REGISTRY: Record<SimulatorType, { info: SimulatorInfo; create: () => Simulator }> = {
|
|
|
|
|
f1_standings: {
|
|
|
|
|
info: { name: "F1 Standings Model", description: "Simulates remaining races using current F1 standings and futures odds" },
|
|
|
|
|
create: () => new F1Simulator(),
|
|
|
|
|
},
|
|
|
|
|
indycar_standings: {
|
|
|
|
|
info: { name: "IndyCar Standings Model", description: "Simulates remaining races using current IndyCar standings and futures odds" },
|
|
|
|
|
create: () => new F1Simulator(),
|
|
|
|
|
},
|
|
|
|
|
golf_qualifying_points: {
|
|
|
|
|
info: { name: "Qualifying Points Model", description: "Simulates remaining majors using current QP standings and futures odds" },
|
|
|
|
|
create: () => new GolfSimulator(),
|
|
|
|
|
},
|
|
|
|
|
playoff_bracket: {
|
|
|
|
|
info: { name: "Bracket Monte Carlo", description: "Simulates playoff bracket outcomes using Elo ratings" },
|
|
|
|
|
create: () => new BracketSimulator(),
|
|
|
|
|
},
|
2026-03-10 23:04:51 -07:00
|
|
|
ucl_bracket: {
|
|
|
|
|
info: { name: "UCL Bracket Monte Carlo", description: "Simulates the UEFA Champions League 16-team knockout bracket using blended Elo + futures odds" },
|
|
|
|
|
create: () => new UCLSimulator(),
|
|
|
|
|
},
|
2026-03-09 15:34:31 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function getSimulator(simulatorType: SimulatorType): Simulator {
|
|
|
|
|
const entry = REGISTRY[simulatorType];
|
|
|
|
|
if (!entry) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
`No simulator registered for type: "${simulatorType}". ` +
|
|
|
|
|
`Add a simulator to app/services/simulations/registry.ts.`
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return entry.create();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getSimulatorInfo(simulatorType: SimulatorType): SimulatorInfo | null {
|
|
|
|
|
return REGISTRY[simulatorType]?.info ?? null;
|
|
|
|
|
}
|
|
|
|
|
|