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.5-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hundredandten_state-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e754cd5195e4e6c7e94f6e2db11abb1de102a9d9898535d0a76ee2049d121870
MD5 75dd3cf8dd1a30b55c48031e9a35e0b0
BLAKE2b-256 56a5f3bbb294d09dd09c5fed424593736560bb4dbf27f4e6bb152f60ce9eae87

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