split components into a separate crate, switched to workspace
This commit is contained in:
parent
951a1aa4d4
commit
316d760b58
23 changed files with 935 additions and 60 deletions
19
rs48_lib/src/controller/random.rs
Normal file
19
rs48_lib/src/controller/random.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use rand::random;
|
||||
|
||||
use super::{Controller, ControllerError, Move};
|
||||
use crate::lib::grid::Grid;
|
||||
|
||||
pub struct RandomController;
|
||||
|
||||
impl RandomController {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
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