trait Warehouse: Clone {
// Required methods
fn boxes(&self) -> HashSet<(usize, usize)>;
fn move_box(&mut self, pos: &(usize, usize), mv: &Move) -> bool;
fn move_robot(&self, mv: &Move) -> Self;
// Provided methods
fn sum_gps(&self) -> usize { ... }
fn apply_moves(&self, moves: &Vec<Move>) -> Self { ... }
fn parse_warehouse(
input: &str,
) -> (HashSet<(usize, usize)>, HashSet<(usize, usize)>, (usize, usize), usize, usize) { ... }
}
Required Methods§
sourcefn move_box(&mut self, pos: &(usize, usize), mv: &Move) -> bool
fn move_box(&mut self, pos: &(usize, usize), mv: &Move) -> bool
Move a box in the provided direction if not blocked, pushing further boxes as needed
sourcefn move_robot(&self, mv: &Move) -> Self
fn move_robot(&self, mv: &Move) -> Self
Move a robot in the provided direction if not blocked, pushing boxes as needed
Provided Methods§
sourcefn apply_moves(&self, moves: &Vec<Move>) -> Self
fn apply_moves(&self, moves: &Vec<Move>) -> Self
Return a copy of this Warehouse
after the robot has followed the list of moves
Object Safety§
This trait is not object safe.