Skip to main content

matchUpFormat Codes

Overview

A matchUpFormat code describes the scoring method used for a specific matchUp, for all matchUps within a structure, for all matchUps within a drawDefinition, or for all matchUps within an event.

Interactive Example

Use the embedded component to dynamically generate matchUpFormat codes:

TODS MatchUp Format Code Generator

SET3-S:6/TB7

  • Standard Advantage
  • Best of 3 Sets to 6 with Advantage
Best Of
3
Ad
Sets
to 6
TB to: 7
@ 6
Win by 2

parse and stringify

import { matchUpFormatCode } from 'tods-competition-factory';

const matchUpFormat = 'SET3-S:6/TB7';

// validate matchUpFormat codes
const valid = matchUpFormatCode.isValidMatchUpFormat({ matchUpFormat });

// parse matchUpFormat codes into an object representation
// tiebreakFormat and tiebreakSet are mutually exclusive
const {
bestOf,
setFormat: {
setTo,
tiebreakAt,
tiebreakFormat: { tiebreakTo },
tiebreakSet: { tiebreakTo },
},
finalSetFormat: {
setTo,
tiebreakAt,
tiebreakFormat: { tiebreakTo },
tiebreakSet: { tiebreakTo },
},
} = matchUpFormatCode.parse(matchUpFormat);

// stringify object representation
const result = matchUpFormatCode.stringify({
bestOf: 1,
setFormat: { timed: true, minutes: 20 },
});

matchUpFormat discovery

In TODS, a drawDefinition is a collection of structures. For example, a MAIN structure and a CONSOLATION structure are considered to be part of the same drawDefinition because they have a logical relationship whereby participants move from one structure to another.

 tournament.events[].drawDefinitions[].structures[].matchUps[]

An application using the Competition Factory can request the matchUpFormat for a given matchUp and the factory engine will traverse the hierarchy from bottom up looking to see at what level a matchUpFormat has been defined. This method will also return any matchUpFormat codes encountered in the hierarchy within which a matchUp is found:

const { matchUpFormat } = engine.getMatchUpFormat({
matchUpId,
drawId,
});

To set the matchUpFormat at each level:

engine.setMatchUpFormat({
matchUpFormat,
structureId, // optional
eventId, // optional
drawId, // optional
});

The matchUpFormat for a matchUp is set at the time of score entry:

engine.setMatchUpStatus({
matchUpFormat,
matchUpId,
outcome,
drawId,
});

parse and stringify

The Competition Factory utilizes matchUpFormatCode functions primarily for validation, but also in the calculation of Round Robin results when determining group finishing positions.

import { matchUpFormatCode } from 'tods-competition-factory';

const matchUpFormat = 'SET3-S:6/TB7';

// validate matchUpFormat codes
const valid = matchUpFormatCode.isValidMatchUpFormat(matchUpFormat);

// parse matchUpFormat codes into an object representation
const {
bestOf,
setFormat: {
setTo,
tiebreakAt,
tiebreakFormat: { tiebreakTo },
},
finalSetFormat: {
setTo,
tiebreakAt,
tiebreakFormat: { tiebreakTo },
},
} = matchUpFormatCode.parse(matchUpFormat);

// stringify object representation
const result = matchUpFormatCode.stringify({
bestOf: 1,
setFormat: { timed: true, minutes: 20 },
});