An engine to play the game Hundred and Ten
Project description
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. |
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hundredandten_engine-0.0.5-py3-none-any.whl.
File metadata
- Download URL: hundredandten_engine-0.0.5-py3-none-any.whl
- Upload date:
- Size: 12.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c37c5929d973faf1b38f7e79917a27054411f46e822a6d6ef6f5e78374ee34be
|
|
| MD5 |
ff79007c7518d518be0a985448ca5311
|
|
| BLAKE2b-256 |
455257976037a8ec1079a6b46281c403ffdebff52e9d5bf8d3e9228a19bc97a8
|