use crate::constants::*;
use crate::state::*;
pub struct LinearGame {
pub states: Vec<State>,
pub state_ptr: usize,
}
impl LinearGame {
pub fn new() -> LinearGame {
LinearGame {
states: vec![State::new(); MAX_STATES],
state_ptr: 0,
}
}
pub fn current(&mut self) -> &mut State {
&mut self.states[self.state_ptr]
}
pub fn pretty_print_string(&mut self) -> String {
self.current().pretty_print_string()
}
pub fn print(&mut self) {
println!("{}", self.pretty_print_string())
}
pub fn init(&mut self, variant: Variant) {
self.state_ptr = 0;
self.current().init(variant);
}
}