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.winnerholds 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.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hundredandten_engine-0.0.11-py3-none-any.whl | Python 3 | none | any | Details |
Release files / hundredandten_engine-0.0.11-py3-none-any.whl
| Download URL | hundredandten_engine-0.0.11-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2e707fa81062a3526c95a6de5a029ee3fe12c12b0352fa883dd89b77a716dbc
|
|
BLAKE2b-256 checksum How to use checksums |
917e62610d227bb0b9700d46b805a672e501d39454640189e8ab530375ed400b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}
|