1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! CarRacing — top-down 2D car racing environment with pixel observations.
//!
//! Implements the CarRacing-v3 Gymnasium environment using Rapier2D physics and
//! a software rasterizer. The agent receives a 96×96 RGB pixel observation and
//! controls steering, gas, and brake inputs to complete a closed-loop track.
//!
//! ## Spaces
//!
//! | | Type | Shape | Range |
//! |---|---|---|---|
//! | Action | Continuous | 3 | `steer ∈ [-1,1]`, `gas ∈ [0,1]`, `brake ∈ [0,1]` |
//! | Observation | Pixel | 96 × 96 × 3 | `u8` per channel |
//!
//! ## Reward structure
//!
//! - `+tile_reward` for each new track tile visited (total ≈ 1000 for a full lap).
//! - `frame_penalty` (default −0.1) applied every step.
//!
//! ## Termination conditions
//!
//! - Car visits ≥ 95% of track tiles → `Terminated` (lap complete).
//! - Step count reaches `config.max_steps` (default 1000) → `Truncated`.
//!
//! ## Track generation
//!
//! Each `reset()` call builds a unique closed-loop track via Catmull-Rom
//! interpolation over randomly perturbed control points. Pass a fixed `seed`
//! in [`CarRacingConfig`] for reproducible episodes.
//!
//! ## Quick start
//!
//! ```no_run
//! # use rlevo_environments::box2d::car_racing::{CarRacing, CarRacingAction, CarRacingConfig};
//! # use rlevo_core::environment::{Environment, Snapshot};
//! let mut env = CarRacing::with_config(CarRacingConfig::default());
//! let _snap = env.reset().unwrap();
//! let snap = env.step(CarRacingAction { steer: 0.0, gas: 0.5, brake: 0.0 }).unwrap();
//! println!("reward: {:?}", snap.reward());
//! ```
pub use CarRacingAction;
pub use ;
pub use CarRacing;
pub use CarRacingObservation;
pub use Rasterizer;
pub use CarRacingState;
pub use Track;