fn valid_move(pos: (usize, usize), min: (usize, usize), max: (usize, usize), dir: Direction) -> bool {
    match dir {
        Direction::L => pos.1 > min.1,
        Direction::R => pos.1 < max.1,
        Direction::U => pos.0 > min.0,
        Direction::D => pos.0 < max.0
    }
}
/// Checks if a position can move in a direction given min and max bounds
Checks if a position can move in a direction given min and max bounds
Checks if a position can move in a direction given min and max bounds
fn valid_move(pos: (usize, usize), min: (usize, usize), max: (usize, usize), dir: Direction) -> bool {
    match dir {
        Direction::L => pos.1 > min.1,
        Direction::R => pos.1 < max.1,
        Direction::U => pos.0 > min.0,
        Direction::D => pos.0 < max.0
    }
}
fn valid_move ( pos : ( usize , usize ) , min : ( usize , usize ) , max : ( usize , usize ) , dir : Direction ) -> bool { match dir { Direction :: L => pos . 1 > min . 1 , Direction :: R => pos . 1 < max . 1 , Direction :: U => pos . 0 > min . 0 , Direction :: D => pos . 0 < max . 0 } }
Checks if a position can move in a direction given min and max bounds
Checks if a position can move in a direction given min and max bounds
pos
(usize, usize)
min
(usize, usize)
max
(usize, usize)
dir
Direction
pos
(usize, usize)
min
(usize, usize)
max
(usize, usize)
dir
Direction