implemented random controller

This commit is contained in:
JOLIMAITRE Matthieu 2022-04-04 17:13:37 +03:00
parent 3f2058e332
commit 4c821be1fe
3 changed files with 30 additions and 1 deletions

View file

@ -0,0 +1,13 @@
use rand::random;
use super::{Controller, ControllerError, Move};
use crate::lib::grid::Grid;
pub struct RandomController;
impl Controller for RandomController {
fn next_move(&mut self, _grid: &Grid) -> Result<Move, ControllerError> {
let movement = random();
Ok(movement)
}
}