pub fn print(&self) {
        let mut map = vec![0; self.width as usize * self.height as usize];
        for (v, vehicle) in self.vehicles.iter().enumerate() {
            let i = vehicle.position.x + vehicle.position.y * self.width;
            match vehicle.alignment {
                Alignment::Horizontal => {
                    for offset in 0..vehicle.size {
                        map[i as usize + offset as usize] = v + 1;
                    }
                }
                Alignment::Vertical => {
                    for offset in 0..vehicle.size {
                        map[i as usize + (offset as u32 * self.width) as usize] = v + 1;
                    }
                }
            }

        }

        for row in map.chunks(self.width as usize) {
            println!();
            print!("|");
            for &thing in row {
                if thing == 0 {
                    print!(" ");
                } else {
                    print!("{}", thing);
                }
            }
            print!("|");
        }

        println!()
    }
/// Prints the stage in a user-friendly way
Prints the stage in a user-friendly way
Prints the stage in a user - friendly way
pub fn print(&self) {
        let mut map = vec![0; self.width as usize * self.height as usize];
        for (v, vehicle) in self.vehicles.iter().enumerate() {
            let i = vehicle.position.x + vehicle.position.y * self.width;
            match vehicle.alignment {
                Alignment::Horizontal => {
                    for offset in 0..vehicle.size {
                        map[i as usize + offset as usize] = v + 1;
                    }
                }
                Alignment::Vertical => {
                    for offset in 0..vehicle.size {
                        map[i as usize + (offset as u32 * self.width) as usize] = v + 1;
                    }
                }
            }
        }
        for row in map.chunks(self.width as usize) {
            println!();
            print!("|");
            for &thing in row {
                if thing == 0 {
                    print!(" ");
                } else {
                    print!("{}", thing);
                }
            }
            print!("|");
        }
        println!()
    }
pub fn print ( & self ) { let mut map = vec ! [ 0 self width as usize self height as usize ] ; for ( v , vehicle ) in self . vehicles . iter ( ) . enumerate ( ) { let i = vehicle . position . x + vehicle . position . y * self . width ; match vehicle . alignment { Alignment :: Horizontal => { for offset in 0 .. vehicle . size { map [ i as usize + offset as usize ] = v + 1 ; } } Alignment :: Vertical => { for offset in 0 .. vehicle . size { map [ i as usize + ( offset as u32 * self . width ) as usize ] = v + 1 ; } } } } for row in map . chunks ( self . width as usize ) { println ! ( ) ; print ! ( " " ) ; for & thing in row { if thing == 0 { print ! ( " " ) ; } else { print ! ( " " thing ) ; } } print ! ( " " ) ; } println ! ( ) }
Prints the stage in a user-friendly way
Prints the stage in a user - friendly way
&self
&self