fn destination_point(&self, direction: Direction) -> Point {
        match self.alignment {
            Alignment::Horizontal => {
                // Vehicle faces to the right
                match direction {
                    Direction::Forward => self.position.translate(self.size as i32, 0),
                    Direction::Backward => self.position.translate(-1, 0)
                }
            }
            Alignment::Vertical => {
                // Vehicle faces down
                match direction {
                    Direction::Forward => self.position.translate(0, self.size as i32),
                    Direction::Backward => self.position.translate(0, -1)
                }
            }
        }
    }
/// Return the point that would be covered by the vehicle moving in the given direction
Return the point that would be covered by the vehicle moving in the given direction
Return the point that would be covered by the vehicle moving in the given direction
fn destination_point(&self, direction: Direction) -> Point {
        match self.alignment {
            Alignment::Horizontal => {
                // Vehicle faces to the right
                match direction {
                    Direction::Forward => self.position.translate(self.size as i32, 0),
                    Direction::Backward => self.position.translate(-1, 0)
                }
            }
            Alignment::Vertical => {
                // Vehicle faces down
                match direction {
                    Direction::Forward => self.position.translate(0, self.size as i32),
                    Direction::Backward => self.position.translate(0, -1)
                }
            }
        }
    }
fn destination_point ( & self , direction : Direction ) -> Point { match self . alignment { Alignment :: Horizontal => { // Vehicle faces to the right match direction { Direction :: Forward => self . position . translate ( self . size as i32 , 0 ) , Direction :: Backward => self . position . translate ( - 1 , 0 ) } } Alignment :: Vertical => { // Vehicle faces down match direction { Direction :: Forward => self . position . translate ( 0 , self . size as i32 ) , Direction :: Backward => self . position . translate ( 0 , - 1 ) } } } }
Return the point that would be covered by the vehicle moving in the given direction
Return the point that would be covered by the vehicle moving in the given direction
&self
direction
Direction
&self
direction
Direction