began simulated controller

This commit is contained in:
JOLIMAITRE Matthieu 2022-04-04 18:32:05 +03:00
parent ddfb320a11
commit 0639869590
2 changed files with 38 additions and 0 deletions

View file

@ -52,3 +52,7 @@ pub trait Controller {
pub mod player; pub mod player;
pub mod random; pub mod random;
pub mod simulated; pub mod simulated;
pub use player::PlayerController;
pub use random::RandomController;
pub use simulated::SimulatedController;

View file

@ -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<Move, ControllerError> {
todo!()
}
}