Skip to main content

hundredandten-engine

Core game engine for the card game Hundred and Ten.

See the root README for the full game rules.

from hundredandten.engine import Game, Player

game = Game([
    Player('player_1'),
    Player('player_2'),
    Player('player_3'),
    Player('player_4'),
])

Exports

Symbol Description
Game Main entry point. Holds all game state and exposes act, status, active_player, scores, and winner.
Status Enum of game phases: BIDDING, TRUMP_SELECTION, DISCARD, COMPLETED, COMPLETED_NO_BIDDERS, WON.
Round A single round in the game.
Player A game participant, identified by a unique string.
Action Base type for all actions passed to Game.act.
Bid Action to place a bid or pass during BIDDING.
BidAmount Enum of valid bid values: FIFTEEN, TWENTY, TWENTY_FIVE, THIRTY, SHOOT_THE_MOON, PASS.
SelectTrump Action to choose the trump suit during TRUMP_SELECTION.
Discard Action to discard cards and refill during DISCARD.
Play Action to play a card into the current trick during TRICKS.
HundredAndTenError Base exception raised on invalid game actions.

Game Status

game.status returns the current phase:

  • Status.BIDDING — Players are placing bids.
  • Status.TRUMP_SELECTION — The winning bidder is choosing trump.
  • Status.DISCARD — Players are discarding cards to refill their hands.
  • Status.COMPLETED — The round is complete; a new round will begin or a winner will be declared.
  • Status.COMPLETED_NO_BIDDERS — The round ended with no bids; the same dealer repeats (up to three times).
  • Status.WON — The game is over. game.winner holds the winning player.

Playing a Game

All mutations go through game.act(action). Only the current game.active_player may act.

Bid

from hundredandten.engine import Bid, BidAmount

game.act(Bid('active_player_identifier', BidAmount.FIFTEEN))

Select Trump

from hundredandten.engine import SelectTrump, SelectableSuit

game.act(SelectTrump('bidder', SelectableSuit.CLUBS))

Discard

from hundredandten.engine import Discard

game.act(Discard('active_player', game.active_round.active_player.hand[1:3]))

Play

from hundredandten.engine import Play

game.act(Play('active_player', game.active_round.active_player.hand[0]))

Reading Game State

game.status        # current Status
game.active_player # Player whose turn it is
game.scores        # dict[str, int] of current scores, e.g. {'p1': 55, 'p2': -15}
game.winner        # Player if Status.WON, otherwise None

Metadata

Release files for hundredandten-engine 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for hundredandten-engine 0.0.9
File Interpreter ABI Platform
hundredandten_engine-0.0.9-py3-none-any.whl Python 3 none any Details

Release files / hundredandten_engine-0.0.9-py3-none-any.whl

Download URL hundredandten_engine-0.0.9-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca0cf1e32cd84326d0f390aefea27b9200d1fed0d6b36aa8cd9fbd365c118cda
BLAKE2b-256 checksum
How to use checksums
180949946288a0632f2c6e609d89f948ecf8f71edcdff96b0da58388e64bbbaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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}

Release history Release notifications | RSS feed

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

This release

0.0.9 This release

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page