whist_core.game.play_order

Ring buffer of players at the table.

Classes

PlayOrder

Iterates over the players at the table.

Module Contents

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)

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

Parameters:

teams (list[whist_core.scoring.team.Team])

rotate(player)

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

Parameters:

player (whist_core.game.player_at_table.PlayerAtTable)

Return type:

PlayOrder

next_order()

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

Return type:

PlayOrder

get_next_player()

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

Return type:

whist_core.game.player_at_table.PlayerAtTable

get_player(player)

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.

Parameters:

player (whist_core.user.player.Player)

Return type:

whist_core.game.player_at_table.PlayerAtTable

to_team_list()

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

Return type:

list[list[whist_core.user.player.Player]]

classmethod _new_order(old_order)
Parameters:

old_order (PlayOrder)

classmethod _new_rotate_order(old_order, rotation)
Parameters: