pub struct PongState {
pub ball_x: f32,
pub ball_y: f32,
pub ball_dx: f32,
pub ball_dy: f32,
pub left_y: f32,
pub right_y: f32,
pub left_score: u32,
pub right_score: u32,
pub steps: usize,
}Expand description
Snapshot of a Pong instance’s simulation state.
Captures ball position/velocity, paddle positions, scores, and step
counter. Does not capture the thread-local RNG used by serve (which
fires on every scoring event). After restore_state, a step that does
not trigger a serve is fully reproducible; a step that scores will
produce a serve toward a freshly sampled direction.
Fields§
§ball_x: f32Ball x position
ball_y: f32Ball y position
ball_dx: f32Ball x velocity
ball_dy: f32Ball y velocity
left_y: f32Left paddle y position
right_y: f32Right paddle y position
left_score: u32Left score
right_score: u32Right score
steps: usizeStep counter
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PongState
impl RefUnwindSafe for PongState
impl Send for PongState
impl Sync for PongState
impl Unpin for PongState
impl UnsafeUnpin for PongState
impl UnwindSafe for PongState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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