From 06398695908fc9029ae8a4e6e114ec8db248feb4 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Mon, 4 Apr 2022 18:32:05 +0300 Subject: [PATCH] began simulated controller --- src/lib/controller.rs | 4 ++++ src/lib/controller/simulated.rs | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/lib/controller/simulated.rs diff --git a/src/lib/controller.rs b/src/lib/controller.rs index 5027590..f2c3698 100644 --- a/src/lib/controller.rs +++ b/src/lib/controller.rs @@ -52,3 +52,7 @@ pub trait Controller { pub mod player; pub mod random; pub mod simulated; + +pub use player::PlayerController; +pub use random::RandomController; +pub use simulated::SimulatedController; diff --git a/src/lib/controller/simulated.rs b/src/lib/controller/simulated.rs new file mode 100644 index 0000000..10d2f47 --- /dev/null +++ b/src/lib/controller/simulated.rs @@ -0,0 +1,34 @@ +use crate::lib::grid::Grid; + +use super::{Controller, ControllerError, Move}; + +pub enum Objective { + Score, + TileCount, +} + +pub struct SimulatedController { + simulations_per_move: usize, + length_of_simulation: usize, + objective: Objective, +} + +impl SimulatedController { + pub fn new( + simulations_per_move: usize, + length_of_simulation: usize, + objective: Objective, + ) -> Self { + Self { + simulations_per_move, + length_of_simulation, + objective, + } + } +} + +impl Controller for SimulatedController { + fn next_move(&mut self, grid: &Grid) -> Result { + todo!() + } +}