whist_core.session.matcher¶
Match making tool.
Module Contents¶
Classes¶
Abstrakt class for player to teams matching. |
|
Distributes the players in the order of the user list. |
|
Distributes the players randomly to teams. |
Attributes¶
- 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: Any) None¶
Initializes the subclass :param kwargs: field from above :return: None
- abstract distribute(users: whist_core.session.userlist.UserList) whist_core.session.distribution.Distribution¶
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
- _apply_distribution(distribution)¶
- class whist_core.session.matcher.RoundRobinMatcher(number_teams: int, **data)¶
Bases:
MatcherDistributes the players in the order of the user list.
- iteration: int = 0¶
- distributions: list[whist_core.session.distribution.Distribution] = []¶
- distribute(users: whist_core.session.userlist.UserList) whist_core.session.distribution.Distribution¶
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
- _precalculate_distributions(number_players: int)¶
- class whist_core.session.matcher.RandomMatcher¶
Bases:
MatcherDistributes the players randomly to teams.
- distribute(users: whist_core.session.userlist.UserList) whist_core.session.distribution.Distribution¶
For given parameter distributes the players to teams. :return: None :rtype: None