GameEnv

Struct GameEnv 

Source
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

Source

pub fn finish_episode_replay(&mut self)

Source§

impl GameEnv

Source

pub fn add_modifier( &mut self, source: CardId, target_player: u8, target_slot: u8, kind: ModifierKind, magnitude: i32, duration: ModifierDuration, ) -> Option<u32>

Source

pub fn new( db: Arc<CardDb>, config: EnvConfig, curriculum: CurriculumConfig, seed: u64, replay_config: ReplayConfig, replay_writer: Option<ReplayWriter>, env_id: u32, ) -> Self

Source

pub fn reset(&mut self) -> StepOutcome

Source

pub fn reset_no_copy(&mut self) -> StepOutcome

Source

pub fn canonical_events(&self) -> &[Event]

Source

pub fn decision_id(&self) -> u32

Source

pub fn action_mask(&self) -> &[u8]

Source

pub fn action_lookup(&self) -> &[Option<ActionDesc>]

Source

pub fn legal_actions(&self) -> &[ActionDesc]

Source

pub fn debug_event_ring_codes(&self, viewer: u8, out: &mut [u32]) -> u16

Source

pub fn debug_event_ring_snapshot(&self, viewer: u8) -> Vec<ReplayEvent>

Source

pub fn set_debug_config(&mut self, debug: DebugConfig)

Source

pub fn apply_action_id(&mut self, action_id: usize) -> Result<StepOutcome>

Source

pub fn apply_action_id_no_copy( &mut self, action_id: usize, ) -> Result<StepOutcome>

Source

pub fn apply_action(&mut self, action: ActionDesc) -> Result<StepOutcome>

Source

pub fn validate_state(&self) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.