1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use super::*; pub struct Standard<G: Game> { game: G, rng: Box<dyn RngCore + Send>, } impl<G: Game> Standard<G> { pub fn new(game: G, rng: impl RngCore + Send + 'static) -> Self { Self { game, rng: Box::new(rng), } } } impl<G: Game> GameProcessorStrategy<G> for Standard<G> { fn process_turn(&mut self, actions: HashMap<usize, G::Action>) -> Vec<G::Event> { self.game.process_turn(&mut self.rng, actions) } fn game(&self) -> &G { &self.game } fn finished(&self) -> bool { self.game.finished() } }