/// Returs an array of tupple containing the index of neighboring
/// cells starting from left to right, top to bottom.
Returs an array of tupple containing the index of neighboring
cells starting from left to right, top to bottom.
Returs an array of tupple containing the index of neighboring cells starting from left to right top to bottom .
fn nbr_indices(&self, i: usize, j: usize) -> Vec<(usize, usize)> {
        let mut indices: Vec<(usize, usize)> = Vec::new();
        for i_offset in 0..3 {
            for j_offset in 0..3 {
                let i_nbr = i + i_offset;
                let j_nbr = j + j_offset;
                if 0 < i_nbr
                    && i_nbr <= self.height()
                    && 0 < j_nbr
                    && j_nbr <= self.width()
                    && (i_nbr, j_nbr) != (i + 1, j + 1)
                {
                    indices.push((i_nbr - 1, j_nbr - 1));
                }
            }
        }
        indices
    }
fn nbr_indices ( & self , i : usize , j : usize ) -> Vec < ( usize , usize ) > { let mut indices : Vec < ( usize , usize ) > = Vec :: new ( ) ; for i_offset in 0 .. 3 { for j_offset in 0 .. 3 { let i_nbr = i + i_offset ; let j_nbr = j + j_offset ; if 0 < i_nbr && i_nbr <= self . height ( ) && 0 < j_nbr && j_nbr <= self . width ( ) && ( i_nbr , j_nbr ) != ( i + 1 , j + 1 ) { indices . push ( ( i_nbr - 1 , j_nbr - 1 ) ) ; } } } indices }
Returs an array of tupple containing the index of neighboring
cells starting from left to right, top to bottom.
Returs an array of tupple containing the index of neighboring cells starting from left to right top to bottom .
&self
i
usize
j
usize