Skip to main content

Crate turnbase

Crate turnbase 

Source
Expand description

Headless, deterministic core of the Turnbase engine.

Async-free, UI-free, pure computation: state plus action to new state. See ARCHITECTURE.md at the workspace root for the design and its rationale.

Structs§

ActivePlayers
An ordered, deterministic set of players who owe a decision.
Pile
An ordered pile of items with deterministic operations.
PlayerId
Identifies one seat in a match.
PlayerView
The standard observation produced by State::view_for: the public zone and the viewer’s own private zone, if any.
Prng
A small, deterministic pseudo-random generator that lives inside game state.
State
State split into a public zone and per-player private zones, plus the match’s random generator.

Enums§

Error
Errors returned by the engine’s checked entry points.

Constants§

MAX_EFFECTS
Upper bound on effects resolved by one resolve_effects call, a guard against a game whose triggers never terminate. A well-formed game resolves in far fewer steps.

Traits§

Determinize
Opt-in resampling of hidden information for imperfect-information search.
EffectSystem
A game that resolves effects through a queue.
Game
A turn-based game defined as pure functions from state and action to new state.
Reversible
Opt-in make/unmake for games where cloning the whole state per search node is too slow (chess-scale branching).

Functions§

resolve_effects
Resolves initial and everything it triggers, applying each effect then enqueuing its follow-ups, in FIFO order.
sample_chance
Samples one outcome from game.chance_outcomes(state), weighted by probability, using rng. Returns None if there are no outcomes.