:py:mod:`whist_core.session.matcher` ==================================== .. py:module:: whist_core.session.matcher .. autoapi-nested-parse:: Match making tool. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: whist_core.session.matcher.Matcher whist_core.session.matcher.RoundRobinMatcher whist_core.session.matcher.RandomMatcher Attributes ~~~~~~~~~~ .. autoapisummary:: whist_core.session.matcher.subclass_registry .. py:data:: subclass_registry .. py:class:: Matcher Bases: :py:obj:`abc.ABC`, :py:obj:`pydantic.BaseModel` Abstrakt class for player to teams matching. .. py:attribute:: teams :type: list[whist_core.session.distribution.Distribution] :value: [] .. py:attribute:: number_teams :type: int .. py:method:: __init_subclass__(**kwargs: Any) -> None :classmethod: Initializes the subclass :param kwargs: field from above :return: None .. py:method:: distribute(users: whist_core.session.userlist.UserList) -> whist_core.session.distribution.Distribution :abstractmethod: 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 .. py:method:: _apply_distribution(distribution) .. py:class:: RoundRobinMatcher(number_teams: int, **data) Bases: :py:obj:`Matcher` Distributes the players in the order of the user list. .. py:attribute:: iteration :type: int :value: 0 .. py:attribute:: distributions :type: list[whist_core.session.distribution.Distribution] :value: [] .. py:method:: 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 .. py:method:: _precalculate_distributions(number_players: int) .. py:class:: RandomMatcher Bases: :py:obj:`Matcher` Distributes the players randomly to teams. .. py:method:: distribute(users: whist_core.session.userlist.UserList) -> whist_core.session.distribution.Distribution For given parameter distributes the players to teams. :return: None :rtype: None