whist_core.session.table¶
DAO of session.
Module Contents¶
Classes¶
The game logics instance of a room to play Whist. |
- class whist_core.session.table.Table(**data: Any)¶
Bases:
whist_core.session.session.SessionThe game logics instance of a room to play Whist.
- property ready: bool¶
Flag if the table is ready to start playing. :return Ready or not :rtype: boolean
- property current_rubber: whist_core.game.rubber.Rubber¶
Returns the current rubber :return: the latest rubber entry
- min_player: int¶
- max_player: int¶
- team_size: int = 2¶
- started: bool = False¶
- rubbers: list[whist_core.game.rubber.Rubber] = []¶
- matcher: whist_core.session.matcher.Matcher¶
- model_dump(*, mode: typing_extensions.Literal[json, python] | str = 'python', include=None, exclude=None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool = True) dict[str, Any]¶
Overrides model_dump to ensure matcher is correctly dumped. :param mode: :param include: :param exclude: :param by_alias: :param exclude_unset: :param exclude_defaults: :param exclude_none: :param round_trip: :param warnings: :return:
- classmethod validate_min_is_lower_max_player(values)¶
Checks if the min_player is less or equal than max_player. :param values: :return:
- __len__()¶
The amount of players joined. :return: # player :rtype: int
- next_rubber() whist_core.game.rubber.Rubber¶
Creates the next rubber. In order to create the first rubber use ‘Table.start()’. :return: the new rubber
- start() None¶
Starts the table, but will check if every player is ready first.
- join(player: whist_core.user.player.Player) None¶
If a seat is available a player joins the table. :param player: who wants to join the table :type player: Player :return: None or raised an error if the table is already full. :rtype: None
- leave(player: whist_core.user.player.Player) None¶
Remove a player from table. :param player: The player to remove. :type player: Player :return: None :rtype: None
- join_team(player: whist_core.user.player.Player, team: int) None¶
Player joins a team. :param player: to join a team :type player: Player :param team: id of the new team :type team: int :return: None if successful or raises Error if team is full :rtype: None
- player_ready(player) None¶
Player says they is ready. :param player: player who is ready :type player: Player :return: None :rtype: None
- player_unready(player) None¶
Player says they is not ready. :param player: player who is not ready :type player: Player :return: None :rtype: None
- _create_rubber()¶