pub struct GameEnv {Show 24 fields
pub db: Arc<CardDb>,
pub config: EnvConfig,
pub curriculum: CurriculumConfig,
pub state: GameState,
pub env_id: u32,
pub episode_index: u32,
pub decision: Option<Decision>,
pub last_action_desc: Option<ActionDesc>,
pub last_action_player: Option<u8>,
pub last_illegal_action: bool,
pub last_engine_error: bool,
pub last_engine_error_code: EngineErrorCode,
pub last_perspective: u8,
pub pending_damage_delta: [i32; 2],
pub obs_buf: Vec<i32>,
pub replay_config: ReplayConfig,
pub replay_writer: Option<ReplayWriter>,
pub replay_actions: Vec<ActionDesc>,
pub replay_events: Vec<ReplayEvent>,
pub replay_steps: Vec<StepMeta>,
pub recording: bool,
pub meta_rng: Rng64,
pub episode_seed: u64,
pub scratch_replacement_indices: Vec<usize>,
/* private fields */
}Expand description
A single Weiss Schwarz environment instance with deterministic RNG state.
Fields§
§db: Arc<CardDb>§config: EnvConfig§curriculum: CurriculumConfig§state: GameState§env_id: u32§episode_index: u32§decision: Option<Decision>§last_action_desc: Option<ActionDesc>§last_action_player: Option<u8>§last_illegal_action: bool§last_engine_error: bool§last_engine_error_code: EngineErrorCode§last_perspective: u8§pending_damage_delta: [i32; 2]§obs_buf: Vec<i32>§replay_config: ReplayConfig§replay_writer: Option<ReplayWriter>§replay_actions: Vec<ActionDesc>§replay_events: Vec<ReplayEvent>§replay_steps: Vec<StepMeta>§recording: bool§meta_rng: Rng64§episode_seed: u64§scratch_replacement_indices: Vec<usize>Implementations§
Source§impl GameEnv
impl GameEnv
pub fn finish_episode_replay(&mut self)
Source§impl GameEnv
impl GameEnv
pub fn add_modifier( &mut self, source: CardId, target_player: u8, target_slot: u8, kind: ModifierKind, magnitude: i32, duration: ModifierDuration, ) -> Option<u32>
pub fn new( db: Arc<CardDb>, config: EnvConfig, curriculum: CurriculumConfig, seed: u64, replay_config: ReplayConfig, replay_writer: Option<ReplayWriter>, env_id: u32, ) -> Self
pub fn reset(&mut self) -> StepOutcome
pub fn reset_no_copy(&mut self) -> StepOutcome
pub fn canonical_events(&self) -> &[Event]
pub fn decision_id(&self) -> u32
pub fn action_mask(&self) -> &[u8] ⓘ
pub fn action_lookup(&self) -> &[Option<ActionDesc>]
pub fn legal_actions(&self) -> &[ActionDesc]
pub fn debug_event_ring_codes(&self, viewer: u8, out: &mut [u32]) -> u16
pub fn debug_event_ring_snapshot(&self, viewer: u8) -> Vec<ReplayEvent> ⓘ
pub fn set_debug_config(&mut self, debug: DebugConfig)
pub fn apply_action_id(&mut self, action_id: usize) -> Result<StepOutcome>
pub fn apply_action_id_no_copy( &mut self, action_id: usize, ) -> Result<StepOutcome>
pub fn apply_action(&mut self, action: ActionDesc) -> Result<StepOutcome>
pub fn validate_state(&self) -> Result<()>
Auto Trait Implementations§
impl Freeze for GameEnv
impl RefUnwindSafe for GameEnv
impl Send for GameEnv
impl Sync for GameEnv
impl Unpin for GameEnv
impl UnwindSafe for GameEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more