Tournament

Instances of this class can manage tournament logic.

This is a facade created to enable exporting the code to JS, though it can also be used directly within the JS modules of any KMP project.

Properties

Link copied to clipboard

Current matches being played.

Link copied to clipboard

Whether the tournament has reached its conclusion.

Link copied to clipboard

All concluded matches in the tournament history.

Link copied to clipboard
val id: Any?

The unique identifier for this tournament.

Link copied to clipboard
val idGenerator: () -> Any?

Unique ID generator for assigning identifiers to match objects.

Link copied to clipboard

The K-factor that determines how much a single match affects the rating. A higher value leads to faster rating changes. Default is 32.0.

Link copied to clipboard

Current player standings, ordered by score and tie-breakers.

Link copied to clipboard

The base of the exponent in the logistic function. Default is 10.

Link copied to clipboard
val name: String?

The display name of the tournament.

Link copied to clipboard

The scale factor used to determine win probability. Default is 400.0.

Link copied to clipboard

Tournament's tiebreakers.

Link copied to clipboard

The specific time settings for the matches (e.g., "3+2", "10|0"). Returns null if no specific time control has been defined.

Link copied to clipboard
val type: String?

The category of the tournament based on the time control (e.g., "blitz", "bullet", "rapid").

Functions

Link copied to clipboard
fun addMatch(white: String, black: String?, outcome: String, id: Any?, round: Int?): Boolean

Adds a match to the tournament for the specified round. This method is ideal for cases where external logic is being used or an instance is being reconstructed.

Link copied to clipboard
fun addPlayer(player: Player)

Adds a player to the tournament. Player's name most be unique.

Link copied to clipboard

Generates a list of new pairings.

Link copied to clipboard
fun removePlayer(player: Player)

Removes a player from the tournament