implemented random controller
This commit is contained in:
parent
3f2058e332
commit
4c821be1fe
3 changed files with 30 additions and 1 deletions
13
src/lib/controller/random.rs
Normal file
13
src/lib/controller/random.rs
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue