weiss_core/
lib.rs

1//! Weiss Schwarz simulator core.
2//!
3//! ## Overview
4//! The engine advances until a decision point, then exposes a fixed action space,
5//! canonical legal actions, and deterministic replays for RL training and analysis.
6//!
7//! ## Docs
8//! - Docs hub: <https://github.com/victorwp288/weiss-schwarz-simulator/blob/main/docs/README.md>
9//! - RL contract: <https://github.com/victorwp288/weiss-schwarz-simulator/blob/main/docs/rl_contract.md>
10//! - Encodings: <https://github.com/victorwp288/weiss-schwarz-simulator/blob/main/docs/encodings.md>
11//! - Replays & determinism: <https://github.com/victorwp288/weiss-schwarz-simulator/blob/main/docs/replays_determinism.md>
12//!
13//! ## Module map
14//! Primary runtime modules:
15//! - `env`: Game environment and advance loop
16//! - `legal`: canonical legal action generation
17//! - `encode`: observation/action encoding and specs
18//! - `pool`: batched stepping and parallelism
19//! - `replay`: replay types and serialization
20//!
21//! Supporting public modules:
22//! - `config`: environment/curriculum/reward configuration types
23//! - `db`: card database, ability templates/defs, and lookups
24//! - `effects`: compiled effect identifiers and payload types
25//! - `error`: common error types and diagnostics helpers
26//! - `events`: canonical event stream schema
27//! - `fingerprint`: stable hashing helpers for config/state/events
28//! - `rules`: rules metadata and policy helpers
29//! - `state`: core game-state structures
30//! - `util`: utility helpers (RNG and small infra)
31//! - `visibility_policy`: visibility/sanitization policy helpers
32#![deny(missing_docs)]
33
34/// Environment, reward, and curriculum configuration types.
35pub mod config;
36/// Card database, ability templates/defs, and lookup helpers.
37pub mod db;
38/// Compiled effect identifiers, payloads, and replay-safe effect schemas.
39pub mod effects;
40/// Observation/action encodings and schema constants.
41pub mod encode;
42/// Core game environment and phase/interaction execution.
43pub mod env;
44/// Shared error types used across core, pool, and Python bindings.
45pub mod error;
46/// Canonical event stream structures used by replays and debugging.
47pub mod events;
48/// Stable hashing helpers for state, config, and event fingerprints.
49pub mod fingerprint;
50/// Legal action generation and decision modeling.
51pub mod legal;
52/// Shared modifier query helpers used by legality/encoding internals.
53pub(crate) mod modifier_queries;
54/// Batched stepping/reset and parallel environment pooling.
55pub mod pool;
56/// Replay file format, IO, and supporting data structures.
57pub mod replay;
58/// Rules metadata helpers and policy wiring.
59pub mod rules;
60/// Core game state model and turn/phase state machines.
61pub mod state;
62/// Utility helpers shared across modules.
63pub mod util;
64/// Observation/replay visibility policy helpers.
65pub mod visibility_policy;
66
67pub use config::{
68    CurriculumConfig, EndConditionPolicy, EnvConfig, ErrorPolicy, ObservationVisibility,
69    RewardConfig, SimultaneousLossPolicy,
70};
71pub use db::{CardDb, CardId};
72pub use env::{DebugConfig, GameEnv, StepOutcome};
73pub use error::{ActionError, ConfigError, EnvError, InvariantError, StateError};
74pub use legal::{ActionDesc, Decision, DecisionKind};
75pub use pool::{
76    BatchOutDebug, BatchOutDebugBuffers, BatchOutMinimal, BatchOutMinimalBuffers, EnvPool,
77};