Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
marceljuenemann committed Oct 16, 2024
1 parent b05224e commit 300fb88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/__tests__/tiebreak.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ describe("TiebreakCalculation", () => {
})

it("should use virtual opponents for unplayed games", () => {
const rounds = new Results(TournamentType.SWISS, [round(["A:B 1:0"]), round(["A:B 1:0 forfeit"])])
const rounds = new Results(TournamentType.SWISS, [
round(["A:B 1:0"]),
round(["A:B 1:0 forfeit"]),
])
const tiebreak = new Tiebreaker(rounds, UnplayedRoundsAdjustment.FIDE_2009)

// A's first opponent contributes (0 + 0.5) and the second (1 + 0)
Expand Down
7 changes: 5 additions & 2 deletions src/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type Pairing = {

export enum TournamentType {
// TODO: Add support for round robin tournaments (where no unplayed games adjustments are made).
SWISS = "SWISS"
SWISS = "SWISS",
}

/**
Expand All @@ -47,7 +47,10 @@ export enum TournamentType {
export class Results {
private pairings: Map<PlayerId, Map<number, PlayerResult>> = new Map()

constructor(public readonly tournamentType: TournamentType, results: RoundResults[]) {
constructor(
public readonly tournamentType: TournamentType,
results: RoundResults[],
) {
for (const [roundIndex, roundResults] of results.entries()) {
for (const pairing of roundResults.pairings) {
this.addToMap(pairing.white, roundIndex + 1, {
Expand Down

0 comments on commit 300fb88

Please sign in to comment.