Last active
July 19, 2024 22:23
-
-
Save hannahherbig/a540f967c70949b2b5f7084bafcc3759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Tournament, { Id } from "./tournament"; | |
export type DuelOptions = { short?: boolean; last?: number }; | |
export default class Duel extends Tournament { | |
constructor(numPlayers: number, opts?: DuelOptions); | |
invalid(numPlayers: number, opts?: DuelOptions): boolean; | |
right(id: Id): [Id, number]; | |
down(id: Id): [Id, number]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Seed = number; | |
export type Score = number; | |
export type Section = number; | |
export type Round = number; | |
export type MatchNum = number; | |
export interface Id { | |
s: Section; | |
r: Round; | |
m: MatchNum; | |
} | |
export interface IdPartial { | |
s?: Section; | |
r?: Round; | |
m?: MatchNum; | |
} | |
export interface Match { | |
id: Id; | |
p: Seed[]; | |
m?: Score[]; | |
} | |
export interface Result { | |
pos: number; | |
seed: Seed; | |
wins: number; | |
for: number; | |
against: number; | |
} | |
export default class Tournament { | |
constructor(numPlayers: number, matches: Match[]); | |
findMatch(id: Id): Match; | |
isPlayable(match: Match): boolean; | |
findMatches(idPartial: IdPartial): Match[]; | |
findMatchesRanged( | |
lowerIdPartial: IdPartial, | |
upperIdPartial: IdPartial | |
): Match[]; | |
currentRound(section?: Section): Round; | |
nextRound(section?: Section): Round; | |
matchesFor(seed: Seed): Match[]; | |
rounds(section?: Section): Match[][]; | |
sections(round?: Round): Match[][]; | |
players(idPartial: IdPartial): Seed[]; | |
results(): Result[]; | |
resultsFor(seed: Seed): Result; | |
upcoming(seed: Seed): Match[]; | |
score(id: Id, mapScore: Score[]): boolean; | |
unscorable(id: Id, mapScore: Score[], allowPast?: boolean): string | null; | |
isDone(): boolean; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment