Engine adapter for wiring automation strategies to the Hundred and Ten game engine
Project description
hundredandten-automation-engineadapter
Bridge between the Hundred and Ten game engine and automation strategies.
This is the only package that depends on both hundredandten-engine and hundredandten-state. It translates engine Game objects into player-agnostic GameState observations that strategies can act on, and converts strategy-layer AvailableAction results back into engine Action objects.
Usage
The most common usage is action_for, which handles the full loop: build state, call a strategy, validate the result, return an engine action.
from hundredandten.automation.engineadapter import EngineAdapter
from hundredandten.automation import naive
from hundredandten.engine import Game, Player
game = Game(players=[Player('player_1'), Player('player_2')])
engine_action = EngineAdapter.action_for(game, 'player_2', naive.action_for)
game.act(engine_action)
Exports
EngineAdapter
All methods are static.
| Method | Signature | Description |
|---|---|---|
action_for |
(game, identifier, decision_fn) -> Action |
Full-loop helper. Builds a GameState for the identified player, calls decision_fn(state), validates that the result is a legal action, and returns the corresponding engine Action. Raises UnavailableActionError if the decision function returns an illegal action. |
state_from_engine |
(game, identifier) -> GameState |
Builds a player-agnostic GameState observation for the identified player. All seats are rotated so the requesting player is seat 0. Cards the player cannot see are marked Unknown. |
available_action_for_player |
(action, identifier) -> Action |
Converts a player-agnostic AvailableAction into a player-aware engine Action by attaching the player identifier. |
available_action_from_engine |
(action) -> AvailableAction |
Converts a player-aware engine Action into a player-agnostic AvailableAction. |
UnavailableActionError
Raised by action_for when the decision function returns an action not present in state.available_actions.
Building state without a strategy
from hundredandten.automation.engineadapter import EngineAdapter
state = EngineAdapter.state_from_engine(game, 'player_1')
print(state.available_actions)
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
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_automation_engineadapter-0.0.5-py3-none-any.whl.
File metadata
- Download URL: hundredandten_automation_engineadapter-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.9 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 |
c4c6f40c51716e697ae863a7fb8ac959c92c3abdb6e9fe4763aa5c2eccdb32c8
|
|
| MD5 |
8ef0be7e9349178dac6885697bd867e1
|
|
| BLAKE2b-256 |
049843298917ea228310892677292f18ccf2a2e6adc001b4e37c567b0769ae93
|