Skip to main content

Player observation layer for the game Hundred and Ten

Project description

hundredandten-state

Player observation layer for the card game Hundred and Ten.

GameState is a player-agnostic snapshot of the game at decision time. All seat positions are relative — the observing player is always seat 0, with other players numbered clockwise. No player identifiers appear in the state. This design makes GameState the natural observation space for automation strategies and future ML training.

GameState is usually constructed by an EngineAdapter from a live Game object. But it may be built directly.

from hundredandten.automation.engineadapter import EngineAdapter

state = EngineAdapter.state_from_engine(game, 'player_1')

print(state.status)            # Status.BIDDING, TRICKS, etc.
print(state.hand)              # tuple[Card, ...] — this player's hand
print(state.available_actions) # tuple of AvailableBid / AvailablePlay / etc.
print(state.table.scores)      # tuple[int, ...] — scores indexed by relative seat

GameState Structure

Field Type Description
status Status Current game phase.
table TableInfo Seat counts, scores, dealer seat, and bidder seat — all relative.
hand tuple[Card, ...] This player's current hand.
bidding BiddingState Bid history, active bid amount, and selected trump.
tricks TrickState Completed tricks and the current in-progress trick.
cards tuple[CardKnowledge, ...] All 53 cards with their known status (InHand, Played, Discarded, or Unknown).

state.available_actions returns the legal actions for the active player given the current phase. Convenience properties available_bids, available_trump_selections, available_discards, and available_plays filter to a specific action type.

Exports

Phase and action types

Symbol Description
Status Enum: BIDDING, TRUMP_SELECTION, DISCARD, TRICKS, WON.
BidAmount IntEnum of bid values: FIFTEEN through SHOOT_THE_MOON and PASS.
AvailableAction Union type: AvailableBid | AvailableSelectTrump | AvailableDiscard | AvailablePlay.
AvailableBid A bid action with an amount: BidAmount.
AvailableSelectTrump A trump selection action with a suit: SelectableSuit.
AvailableDiscard A discard action with cards: tuple[Card, ...]. Order-insensitive equality.
AvailablePlay A play action with a card: Card.

State structure types

Symbol Description
GameState Top-level observation. See structure table above.
TableInfo num_players, dealer_seat, bidder_seat, scores — all relative.
BiddingState bid_history: tuple[BidEvent, ...], active_bid: BidAmount | None, trump: SelectableSuit | None.
TrickState completed_tricks: tuple[CompletedTrick, ...], current_trick_plays: tuple[TrickPlay, ...].
BidEvent A bid in the history: seat: int, amount: BidAmount.
TrickPlay A card played in a trick: seat: int, card: Card.
CompletedTrick A finished trick: plays: tuple[TrickPlay, ...], winner_seat: int.

Card knowledge types

Symbol Description
CardKnowledge Pairs a card: Card with its status: CardStatus.
CardStatus Union type: InHand | Played | Discarded | Unknown.
InHand Card is in this player's hand.
Played Card was played in trick_index by relative seat.
Discarded Card was discarded by this player.
Unknown Card location is not visible to this player.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hundredandten_state-0.0.6-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file hundredandten_state-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: hundredandten_state-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hundredandten_state-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7f1f9a1e6e03a41b5195f91be9cafd8346fb1ce12361081579de0888eb51ef6c
MD5 a8f8b3ff3e1bc72675d1e2ebaf9c8b3b
BLAKE2b-256 f4370d332a721e89bbb82057a9d1bff6769e25cc8f87fea4ea26935e808e9568

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page