fn move_(&mut self, direction: Direction) {
        let new_pos = match self.alignment {
            Alignment::Horizontal => {
                // Vehicle faces to the right
                match direction {
                    Direction::Forward => self.position.translate(1, 0),
                    Direction::Backward => self.position.translate(-1, 0)
                }
            }
            Alignment::Vertical => {
                // Vehicle faces down
                match direction {
                    Direction::Forward => self.position.translate(0, 1),
                    Direction::Backward => self.position.translate(0, -1)
                }
            }
        };

        self.position = new_pos;
    }
/// Move the vehicle in the given direction
///
/// Note: wrapping overflow and underflow are used
Move the vehicle in the given direction
Note: wrapping overflow and underflow are used
Move the vehicle in the given direction Note : wrapping overflow and underflow are used
fn move_(&mut self, direction: Direction) {
        let new_pos = match self.alignment {
            Alignment::Horizontal => {
                // Vehicle faces to the right
                match direction {
                    Direction::Forward => self.position.translate(1, 0),
                    Direction::Backward => self.position.translate(-1, 0)
                }
            }
            Alignment::Vertical => {
                // Vehicle faces down
                match direction {
                    Direction::Forward => self.position.translate(0, 1),
                    Direction::Backward => self.position.translate(0, -1)
                }
            }
        };
        self.position = new_pos;
    }
fn move_ ( & mut self , direction : Direction ) { let new_pos = match self . alignment { Alignment :: Horizontal => { // Vehicle faces to the right match direction { Direction :: Forward => self . position . translate ( 1 , 0 ) , Direction :: Backward => self . position . translate ( - 1 , 0 ) } } Alignment :: Vertical => { // Vehicle faces down match direction { Direction :: Forward => self . position . translate ( 0 , 1 ) , Direction :: Backward => self . position . translate ( 0 , - 1 ) } } } ; self . position = new_pos ; }
Move the vehicle in the given direction
Note: wrapping overflow and underflow are used
Move the vehicle in the given direction Note : wrapping overflow and underflow are used
&mut self
direction
Direction
&mut self
direction
Direction