whist_core.game.play_order

Ring buffer of players at the table.

Module Contents

Classes

PlayOrder

Iterates over the players at the table.

class whist_core.game.play_order.PlayOrder

Bases: pydantic.BaseModel

Iterates over the players at the table.

next_player: int
play_order: list[whist_core.game.player_at_table.PlayerAtTable]
__iter__()

Iteration over all players.

static from_team_list(teams: list[whist_core.scoring.team.Team])

Factory method to create a play order from a team list. :param teams: list of teams :return: PlayOrder

rotate(player: whist_core.game.player_at_table.PlayerAtTable) PlayOrder

Rotates the play order, so the player will be next player. :param player: who should be at beginning of the play order :return: None

next_order() PlayOrder

Create the order for the next hand. :rtype: PlayOrder

get_next_player() whist_core.game.player_at_table.PlayerAtTable

Retrieves the next player who’s turn it is. :rtype: PlayOrder

get_player(player: whist_core.user.player.Player) whist_core.game.player_at_table.PlayerAtTable

Retrieves the PlayerAtTable for the player given. :param player: who needs it’s counterpart at the table :return: the player at table :raises PlayerNoteJoinedError: when a player is requested but is not in play order.

to_team_list() list[list[whist_core.user.player.Player]]

Returns a two-dimensional array of players sorted by teams.

classmethod _new_order(old_order: PlayOrder)
classmethod _new_rotate_order(old_order: PlayOrder, rotation: int)