maverick.protocol.PlayerLike#

class maverick.protocol.PlayerLike(*args, **kwargs)[source]#

Protocol defining the interface for a valid player implementation.

Any class implementing this protocol can participate in a Texas Hold’em game. Custom player classes must implement all methods defined in this protocol.

uid#

Unique identifier for the player. Replaces deprecated id.

Type:

Optional[str]

name#

Display name for the player.

Type:

Optional[str]

state#

Current player state containing seat, stack, holding, bets, etc.

Type:

Optional[PlayerState]

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

decide_action(*, game, valid_actions, ...)

Decide what action to take given the current game state.

to_dict()

Serialize the player to a dictionary representation.

Attributes

decide_action(*, game: Game, valid_actions: list[ActionType], min_raise_amount: int, call_amount: int, min_bet_amount: int) PlayerAction[source]#

Decide what action to take given the current game state.

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:

PlayerAction

to_dict() dict[source]#

Serialize the player to a dictionary representation.

Returns:

A dictionary containing the player’s attributes.

Return type:

dict