maverick.state.GameState#

class maverick.state.GameState(*, stage: GameStage = GameStage.WAITING_FOR_PLAYERS, street: Street | None = None, players: list[PlayerLike] = <factory>, current_player_index: int | None = None, deck: Deck | None = None, community_cards: list[Card] = <factory>, pot: int = 0, current_bet: int = 0, min_bet: int = 0, last_raise_size: int = 0, small_blind: Annotated[int, ~annotated_types.Ge(ge=1)] = 10, big_blind: Annotated[int, ~annotated_types.Ge(ge=1)] = 20, ante: Annotated[int, ~annotated_types.Ge(ge=0)] = 0, hand_number: int = 0, button_position: int | None = None, small_blind_position: int | None = None, big_blind_position: int | None = None)[source]#

Represents the complete state of a Texas Hold’em game.

This class encapsulates all information about the current state of the game, including players, community cards, pot, and betting information.

Fields#

stageGameStage

The current state of the game (e.g., WAITING_FOR_PLAYERS, IN_PROGRESS).

Added in version 0.2.0.

streetOptional[Street]

The current betting round (e.g., PRE_FLOP, FLOP, TURN, RIVER).

playerslist[PlayerLike]

The list of players in the game.

current_player_indexOptional[int]

The index of the player whose turn it is to act.

deckOptional[Deck]

The deck of cards used in the game.

community_cardslist[Card]

The community cards on the table.

potint

The total amount of chips in the pot.

current_betint

The current highest bet that players need to match.

min_betint

The minimum bet amount for the current betting round.

last_raise_sizeint

The size of the last raise made in the current betting round.

small_blindint

The amount of the small blind.

big_blindint

The amount of the big blind.

anteint

The ante amount for the game.

hand_numberint

The current hand number in the game.

button_positionOptional[int]

The position (seat index) of the dealer button at the table.

small_blind_positionOptional[int]

The position (seat index) of the small blind at the table.

Added in version 0.3.0.

big_blind_positionOptional[int]

The position (seat index) of the big blind at the table.

Added in version 0.3.0.

__init__(**data: Any) None#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Methods

__init__(**data)

Create a new model by parsing and validating input data from keyword arguments.

construct([_fields_set])

copy(*[, include, exclude, update, deep])

Returns a copy of the model.

dict(*[, include, exclude, by_alias, ...])

from_orm(obj)

get_active_players()

Return list of players who haven't folded and have chips.

get_players_in_hand()

Return list of players still in the hand (not folded).

is_betting_round_complete()

Betting round is complete when no further action is possible/required.

json(*[, include, exclude, by_alias, ...])

model_construct([_fields_set])

Creates a new instance of the Model class with validated data.

model_copy(*[, update, deep])

!!! abstract "Usage Documentation"

model_dump(*[, mode, include, exclude, ...])

!!! abstract "Usage Documentation"

model_dump_json(*[, indent, ensure_ascii, ...])

!!! abstract "Usage Documentation"

model_json_schema(by_alias, ref_template, ...)

Generates a JSON schema for a model class.

model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

model_post_init(context, /)

Override this method to perform additional initialization after __init__ and model_construct.

model_rebuild(*[, force, raise_errors, ...])

Try to rebuild the pydantic-core schema for the model.

model_validate(obj, *[, strict, extra, ...])

Validate a pydantic model instance.

model_validate_json(json_data, *[, strict, ...])

!!! abstract "Usage Documentation"

model_validate_strings(obj, *[, strict, ...])

Validate the given object with string data against the Pydantic model.

parse_file(path, *[, content_type, ...])

parse_obj(obj)

parse_raw(b, *[, content_type, encoding, ...])

schema([by_alias, ref_template])

schema_json(*[, by_alias, ref_template])

update_forward_refs(**localns)

validate(value)

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

state_type

Get the current game state type.

stage

street

players

current_player_index

deck

community_cards

pot

current_bet

min_bet

last_raise_size

small_blind

big_blind

ante

hand_number

button_position

small_blind_position

big_blind_position

model_config = {'arbitrary_types_allowed': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property state_type: GameStage#

Get the current game state type.

Deprecated since version 0.2.0: Use stage attribute instead.

get_active_players() list[PlayerLike][source]#

Return list of players who haven’t folded and have chips.

get_players_in_hand() list[PlayerLike][source]#

Return list of players still in the hand (not folded).

is_betting_round_complete() bool[source]#

Betting round is complete when no further action is possible/required.