SwissTournament

class SwissTournament(val eloCalculator: EloCalculator = EloCalculator(), val idGenerator: () -> Any? = null, val id: Any? = null, val name: String? = null, val timeControl: String? = null, val type: String? = null) : Tournament

A swiss style tournament.

Since

1.0.0-beta.8

Author

lunalobos

Constructors

Link copied to clipboard
constructor(eloCalculator: EloCalculator = EloCalculator(), idGenerator: () -> Any? = null, id: Any? = null, name: String? = null, timeControl: String? = null, type: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val activeMatches: List<Match>

Current matches being played.

Link copied to clipboard
open override var completed: Boolean

Whether the tournament has reached its conclusion.

Link copied to clipboard
open override val eloCalculator: EloCalculator

The strategy used for rating adjustments.

Link copied to clipboard
open override val finishedMatches: List<Match>

All concluded matches in the tournament history.

Link copied to clipboard
open override val id: Any?

The unique identifier for this tournament.

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

Unique ID generator for assigning identifiers to match objects.

Link copied to clipboard
open override val leaderboard: List<Player>

Standings sorted by score and tie-breakers.

Link copied to clipboard
open override val name: String?

The display name of the tournament.

Link copied to clipboard

Total rounds expected for this tournament.

Link copied to clipboard
open override var playersComparator: Comparator<Player>

The strategy used to break ties between players with the same score. Updating this field automatically updates the ranking logic.

Link copied to clipboard
open override val timeControl: String?

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
open override val type: String?

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

Functions

Link copied to clipboard
open override 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 addMatchOf(white: Player, black: Player)

Manually defines a pairing for the first round.

Link copied to clipboard
open override fun addPlayer(player: Player)

Adds a player to the tournament registry.

Link copied to clipboard
open override fun nextRound(): List<Match>

Generates the next round of the tournament. Pairs players with similar scores who haven't played each other yet.

Link copied to clipboard
open override fun removePlayer(player: Player)

Removes a player from the tournament.