Skip to main content

SessionApp

Struct SessionApp 

Source
pub struct SessionApp<G>
where G: PrintableGame + Clone, G::Action: Debug,
{ /* private fields */ }
Expand description

An interactive session over a Simulator: the dashboard plus a setup modal, Auto/Step control, speed, reset, and a human-playable seat.

Fixes the dashboard’s viewing seat at the lowest human seat (or a neutral spectator if there is none) each time the match is (re)built, so a human never sees another seat’s hidden information. That single fixed viewer means a hidden-info game configured with two or more human seats is local pass-and-play that shows one seat’s view throughout; it is not safe for competitive hot-seat play of a game with private state (the same limitation the CLI’s text play documents).

Implementations§

Source§

impl<G> SessionApp<G>
where G: PrintableGame + Clone, G::Action: Debug,

Source

pub fn new(game: G, bots: Vec<BotOption<G>>, seed: u64) -> Self

Builds a session for game with the given bots available as AI types (at least random_bot is always included), every seat an AI, Auto mode, seeded from seed.

Source

pub fn with_human_seat(self, seat: usize) -> Self

Marks seat human (it plays through the action menu). Out-of-range seats are ignored.

Source

pub fn with_setup_open(self, open: bool) -> Self

Opens (or closes) the setup modal on start, so a native player configures seats before the match runs.

Source

pub const fn with_step_mode(self) -> Self

Starts in Step mode (advance one decision per Space) rather than Auto.

Source

pub fn is_terminal(&self) -> bool

Whether the match has ended and the setup modal is closed (so a demo harness can decide when to restart).

Source

pub fn into_simulator(self) -> Simulator<G>

Unwraps to the underlying Simulator at its current state.

Trait Implementations§

Source§

impl<G, B> App<B> for SessionApp<G>
where G: PrintableGame + Clone, G::Action: Debug, B: Backend,

Source§

fn update(&mut self, term: &mut Terminal<B>, frame: &Frame) -> Flow

Advance and render one frame. Read more

Auto Trait Implementations§

§

impl<G> Freeze for SessionApp<G>
where G: Freeze, <G as Game>::State: Freeze,

§

impl<G> !RefUnwindSafe for SessionApp<G>

§

impl<G> !Send for SessionApp<G>

§

impl<G> !Sync for SessionApp<G>

§

impl<G> Unpin for SessionApp<G>
where G: Unpin, <G as Game>::State: Unpin,

§

impl<G> UnsafeUnpin for SessionApp<G>
where G: UnsafeUnpin, <G as Game>::State: UnsafeUnpin,

§

impl<G> !UnwindSafe for SessionApp<G>

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, 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.