whist_core.session.table
DAO of session.
Classes
The game logics instance of a room to play Whist. |
Module Contents
- class whist_core.session.table.Table(**data)
Bases:
whist_core.session.session.SessionThe game logics instance of a room to play Whist.
- Parameters:
data (Any)
- 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='python', include=None, exclude=None, context=None, by_alias=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, round_trip=False, warnings=True, fallback=None, serialize_as_any=False)
Overrides model_dump to ensure matcher is correctly dumped.
- Parameters:
mode (typing_extensions.Literal[json, python] | str)
by_alias (bool | None)
exclude_unset (bool)
exclude_defaults (bool)
exclude_none (bool)
round_trip (bool)
warnings (bool | typing_extensions.Literal[none, warn, error])
fallback (Callable[[Any], Any] | None)
serialize_as_any (bool)
- Return type:
dict[str, Any]
- 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
- property ready: bool
Flag if the table is ready to start playing. :return Ready or not :rtype: boolean
- Return type:
bool
- property current_rubber: whist_core.game.rubber.Rubber
Returns the current rubber :return: the latest rubber entry
- Return type:
- next_rubber()
Creates the next rubber. In order to create the first rubber use ‘Table.start()’. :return: the new rubber
- Return type:
- start()
Starts the table, but will check if every player is ready first.
- Return type:
None
- join(player)
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
- Parameters:
player (whist_core.user.player.Player)
- Return type:
None
- leave(player)
Remove a player from table. :param player: The player to remove. :type player: Player :return: None :rtype: None
- Parameters:
player (whist_core.user.player.Player)
- Return type:
None
- join_team(player, team)
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
- Parameters:
player (whist_core.user.player.Player)
team (int)
- Return type:
None
- player_ready(player)
Player says they is ready. :param player: player who is ready :type player: Player :return: None :rtype: None
- Return type:
None
- player_unready(player)
Player says they is not ready. :param player: player who is not ready :type player: Player :return: None :rtype: None
- Return type:
None
- _create_rubber()