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)Return list of players who haven't folded and have chips.
Return list of players still in the hand (not folded).
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_fieldsConfiguration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_extraGet extra fields set during validation.
model_fieldsmodel_fields_setReturns the set of fields that have been explicitly set on this model instance.
Get the current game state type.
stagestreetplayerscurrent_player_indexdeckcommunity_cardspotcurrent_betmin_betlast_raise_sizesmall_blindbig_blindantehand_numberbutton_positionsmall_blind_positionbig_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).