whist_core.session.matcher
Match making tool.
Attributes
Classes
Abstrakt class for player to teams matching. |
|
Distributes the players in the order of the user list. |
|
Distributes the players randomly to teams. |
Module Contents
- whist_core.session.matcher.subclass_registry
- class whist_core.session.matcher.Matcher
Bases:
abc.ABC,pydantic.BaseModelAbstrakt class for player to teams matching.
- teams: list[whist_core.session.distribution.Distribution] = []
- number_teams: int
- classmethod __init_subclass__(**kwargs)
Initializes the subclass :param kwargs: field from above :return: None
- Parameters:
kwargs (Any)
- Return type:
None
- abstractmethod distribute(users)
Distributes cards according to subclass implementation. :param users: the players to be distributed to teams :return: the list of teams with players distributed to them
- Parameters:
- Return type:
- _apply_distribution(distribution)
- class whist_core.session.matcher.RoundRobinMatcher(number_teams, **data)
Bases:
MatcherDistributes the players in the order of the user list.
- Parameters:
number_teams (int)
- iteration: int = 0
- distributions: list[whist_core.session.distribution.Distribution] = []
- distribute(users)
Distributes one player to each team each round in order of the user list. Repeats until the user list is empty. :param users: the players to be distributed to teams :return: the teams in round robin distribution
- Parameters:
- Return type:
- _precalculate_distributions(number_players)
- Parameters:
number_players (int)