pub struct SimulationRunner<G: PrintableGame> { /* private fields */ }Expand description
Drives a Simulator behind a fixed dashboard.
The game’s own viewport sits on the left, a stats panel and (when a human is up) an action-select menu stack on the right, and a scrolling log strip runs along the bottom.
Implements [App] for every [Backend], so the same runner drives a real
terminal (retroglyph-crossterm) or an in-memory [retroglyph_core::backend::Headless]
test session unchanged; run is the convenience entry point for the
former. Escape ends the loop early regardless of whose turn it is; once
the match reaches a terminal state the dashboard keeps rendering the
final position (rather than exiting the instant it happens, which would
hide it) and waits for Enter or Escape to close.
Implementations§
Source§impl<G: PrintableGame> SimulationRunner<G>
impl<G: PrintableGame> SimulationRunner<G>
Sourcepub fn new(simulator: Simulator<G>, ai_tick: Duration) -> Self
pub fn new(simulator: Simulator<G>, ai_tick: Duration) -> Self
Wraps simulator, polling an AI-controlled active seat for a move
once every ai_tick of wall-clock time (via [Frame::delta]) rather
than on every single frame, so AI turns are visible instead of
flashing past.
Fixes the dashboard’s viewing seat for the whole match at
Simulator::primary_human (or a neutral spectator if there is no
human seat), computed once here rather than every frame.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Returns whether the wrapped match has reached a terminal state.
True while the dashboard is showing its “match over” prompt and
waiting for Enter/Escape, per SimulationRunner’s own docs.
Sourcepub fn into_simulator(self) -> Simulator<G>
pub fn into_simulator(self) -> Simulator<G>
Unwraps the runner, returning the Simulator at its current state
(e.g. after the loop exits, to inspect the final position or log).