Code Example

Components options are available at the package top level.

1from rstt import Player, BasicElo
2from rstt import SingleEliminationBracket, LogSolver

Instaciate large number of players and track them in a ranking.

1# some player
2population = Player.create(nb=16)
3
4# a ranking
5elo = BasicElo(name='Elo Ranking', players=population)
6
7# display the ranking to the standard output
8elo.plot()

Automatic game generation with seedings and probabilistic game outcome in few steps.

 1# create a competition with elo ranking for seedings.
 2tournament = SingleEliminationBracket(name='RSTT World Cup 2024',
 3                                    seeding=elo,
 4                                    solver=LogSolver())
 5
 6# register player - unranked partcipants get assigned lower seeds
 7tournament.registration(population)
 8
 9# play the tournament
10tournament.run()

Intuitive ranking

1# update the ranking based on the game played
2elo.update(games=tournament.games())
3
4# display the updated ranking
5elo.plot()

Compare ‘trained’ ranking wiht ‘model’ ranking

1# Using the LogSolver implies a 'Consensus' Ranking based on 'the real level' of players.
2from rstt import BTRanking
3truth = BTRanking(name='Consensus Ranking', players=population)
4truth.plot()

Code Execution Explanation

When multiple playesr are created at once, each gets a random name and a random level. In a ranking, player are mapped to a default rating and corresponding rank. The rank of a player is computed with an internal ordinal method that converts rating into float - the value dsiplayed in the standard output. Ranking in rstt are automaticaly sorted whenever a get/set operation is performed, this include update() calls. You do not need to worry about it.

A competition instanciation needs a seeding, which helps deciding how participants are paired. The seeding gives no indication about which player should play, there is a dedicated register method for that purpose.

The tournament.run() triggers an entire workflows that involve a matching logic (specific to the class) and a solver to generate game results.

Once a tournament is completed, its results can be used to update a ranking. For example a Elo ratings use the games results.

The benefit of simulation is that there is a known probabilistic model inherent to the data production. The BTRanking is a special ranking where the rating of the player is their level. It serves as a practical reference for trained system.