Skip to main content

thrust_rl/env/games/
mod.rs

1//! Game environment implementations
2//!
3//! This module contains various game environments for reinforcement learning:
4//! - CartPole: Classic cart-pole balancing task
5//! - FlickeringCartPole: CartPole whose 4-D observation is blanked to zeros
6//!   with a seeded probability `p` (default 0.5) — the Hausknecht & Stone
7//!   (2015) flickering-Atari POMDP protocol. Memory is load-bearing: a
8//!   feedforward policy cannot act on a blanked frame, so recurrence wins by
9//!   construction (issue #287, epic #262)
10//! - MaskedCartPole: CartPole with the two velocity coordinates dropped from
11//!   the observation. Retained as a documented NEGATIVE result — a 500k-step
12//!   run showed a memoryless `[x, theta]` controller solves it, so
13//!   velocity-masking alone does NOT make memory load-bearing (issue #287)
14//! - TMaze: the provably memory-hard T-maze POMDP (Bakker 2001). A cue is shown
15//!   only at step 0; the agent must recall it `N` steps later to turn correctly
16//!   at the junction. A memoryless policy is provably at chance (50%) — the
17//!   clean qualitative memory contrast that FlickeringCartPole only
18//!   approximates (issue #302, epic #262)
19//! - GridWorld: in-tree `4x4` FrozenLake-style sparse-reward navigation task
20//!   (issue #182, `i64` discrete action `0=Up/1=Right/2=Down/3=Left`, 16-dim
21//!   one-hot observation, absorbing goal/hole terminals + step-cap truncation)
22//! - Snake: Snake game with configurable grid size
23//! - SimpleBandit: Simple multi-armed bandit for testing
24//! - Pong: Single-player Pong vs rule-based opponent
25//! - ContinuousLqr: 1D LQR placeholder env that exercises the continuous
26//!   (`Vec<f32>`) action surface added in issue #61
27//! - PendulumSwingUp: in-tree `Pendulum-v1` swing-up task; the canonical
28//!   continuous-control SAC benchmark (issue #139, length-1 `Vec<f32>` torque
29//!   action, 3-dim `[cos θ, sin θ, θ̇]` observation)
30//! - MountainCarContinuous: in-tree `MountainCarContinuous-v0` classic-control
31//!   task; a sparse/deceptive-reward continuous-control benchmark (issue #166,
32//!   length-1 `Vec<f32>` force action, 2-dim `[position, velocity]`
33//!   observation, real terminal state at the goal)
34//! - BucketBrigade (feature `env-bucket-brigade`): Slepian-Wolf MARL research
35//!   env wrapping `bucket_brigade_core` with the versioned scenario registry
36//!   from bucket-brigade PR #379
37//! - MatchingPennies (feature `training`): 2-agent zero-sum smoke env
38//!   implementing `JointEnv` for the multi-agent + PSRO trainers; canonical
39//!   testbed for mixed-equilibrium learners (issue #107).
40//! - NPlayerMatchingPennies (feature `training`): N-player "majority game"
41//!   generalization. Each agent's reward is `+1` if its action matches the
42//!   strict majority of *other* agents' actions, `-1` if against, `0` on tie
43//!   (odd N only). Smoke env for N-player PSRO/NFSP testing (issue #119).
44
45pub mod cartpole;
46pub mod continuous_lqr;
47pub mod flickering_cartpole;
48pub mod grid_world;
49pub mod masked_cartpole;
50#[cfg(feature = "training")]
51pub mod matching_pennies;
52pub mod mountain_car_continuous;
53#[cfg(feature = "training")]
54pub mod n_player_matching_pennies;
55pub mod pendulum;
56pub mod pong;
57#[cfg(feature = "training")]
58pub mod signaling;
59pub mod simple_bandit;
60pub mod snake;
61pub mod t_maze;
62
63#[cfg(feature = "env-bucket-brigade")]
64pub mod bucket_brigade;
65
66#[cfg(feature = "env-atari")]
67pub mod atari;
68
69// Re-export main types for convenience
70#[cfg(feature = "env-atari")]
71pub use atari::AtariEnv;
72#[cfg(feature = "env-bucket-brigade")]
73pub use bucket_brigade::BucketBrigadeMaEnv;
74pub use cartpole::CartPole;
75pub use continuous_lqr::ContinuousLqr;
76pub use flickering_cartpole::FlickeringCartPole;
77pub use grid_world::GridWorld;
78pub use masked_cartpole::MaskedCartPole;
79#[cfg(feature = "training")]
80pub use matching_pennies::MatchingPennies;
81pub use mountain_car_continuous::MountainCarContinuous;
82#[cfg(feature = "training")]
83pub use n_player_matching_pennies::NPlayerMatchingPennies;
84pub use pendulum::PendulumSwingUp;
85pub use pong::Pong;
86#[cfg(feature = "training")]
87pub use signaling::SignalingGame;
88pub use simple_bandit::SimpleBandit;
89pub use snake::SnakeEnv;
90pub use t_maze::TMaze;