began simulated controller
This commit is contained in:
parent
ddfb320a11
commit
0639869590
2 changed files with 38 additions and 0 deletions
|
@ -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;
|
||||||
|
|
34
src/lib/controller/simulated.rs
Normal file
34
src/lib/controller/simulated.rs
Normal 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!()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue