maverick.player.Player#
- class maverick.player.Player(*, uid: str | None = None, name: str, state: PlayerState | dict | None = None, **kwargs)[source]#
Abstract base class for a poker player.
- __init__(*, uid: str | None = None, name: str, state: PlayerState | dict | None = None, **kwargs)[source]#
Methods
__init__(*[, uid, state])decide_action(*, game, valid_actions, ...)Decide on an action to take during the player's turn.
get_by_uid(uid)Get a player class by its unique identifier.
on_event(event, game)Optional hook called when a game event occurs.
to_dict()Serialize the player to a dictionary.
Attributes
cls_uiduse
uidinstead.register- classmethod get_by_uid(uid: str) type[Player] | None[source]#
Get a player class by its unique identifier.
- abstractmethod decide_action(*, game: Game, valid_actions: list[ActionType], min_raise_amount: int, call_amount: int, min_bet_amount: int) PlayerAction[source]#
Decide on an action to take during the player’s turn.
The function should return a valid instance of PlayerAction.
- Parameters:
game (Game) – The game instance containing the current state.
valid_actions (list[ActionType]) – List of valid actions the player can take.
min_raise_amount (int) – Minimum extra chips this player must add right now to complete a minimum raise.
call_amount (int) – Amount of chips this player must add right now to call the current bet.
min_bet_amount (int) – Minimum chips this player must add right now to make a bet.
- Returns:
An instance of PlayerAction representing the chosen action.
- Return type:
- on_event(event: GameEvent, game: Game) None[source]#
Optional hook called when a game event occurs.
This method is called synchronously after global event handlers. Exceptions in this method are caught and logged by the engine.
- Parameters:
Notes
This is an optional hook. The default implementation does nothing. Subclasses can override this method to observe events.