fn count_live_neighbors(&mut self, row: usize, col: usize) -> usize {
        // live nieghbor count
        let mut n: usize = 0;
    
        // negatives are not allowed in ranges in rust :/
        // so i have to shift things and make i32 copies of the usizes
        let mut i: i32 = -1;
        let mut j: i32 = -1;

        let r: i32 = row.try_into().unwrap();
        let c: i32 = col.try_into().unwrap();
        let height: i32 = self.height.try_into().unwrap();
        let width: i32 = self.width.try_into().unwrap();

        // iterate through neighbors
        while i < 2 {
            while j < 2 {
                if i == 0 && j == 0 { // if at reference element
                    // do nothing (quick but lazy sorry)
                } else {
                    // if location is in board
                    if r + i >= 0 && r + i < height && 
                    c + j >= 0 && c + j < width {
                        // if live
                        // can only index with usize so must typecast
                        if self.board[(r + i) as usize][(c + j) as usize] == true {
                            n += 1; // increment live count
                        }
                    }
                }

                j += 1;
            }

            i += 1;
            j = -1;
        }
        
    
        // return live count
        n
    }
// counts the number of neighbors around board element at (row,col) that are alive
counts the number of neighbors around board element at (row,col) that are alive
counts the number of neighbors around board element at ( row col ) that are alive
fn count_live_neighbors(&mut self, row: usize, col: usize) -> usize {
        // live nieghbor count
        let mut n: usize = 0;
        // negatives are not allowed in ranges in rust :/
        // so i have to shift things and make i32 copies of the usizes
        let mut i: i32 = -1;
        let mut j: i32 = -1;
        let r: i32 = row.try_into().unwrap();
        let c: i32 = col.try_into().unwrap();
        let height: i32 = self.height.try_into().unwrap();
        let width: i32 = self.width.try_into().unwrap();
        // iterate through neighbors
        while i < 2 {
            while j < 2 {
                if i == 0 && j == 0 { // if at reference element
                    // do nothing (quick but lazy sorry)
                } else {
                    // if location is in board
                    if r + i >= 0 && r + i < height && 
                    c + j >= 0 && c + j < width {
                        // if live
                        // can only index with usize so must typecast
                        if self.board[(r + i) as usize][(c + j) as usize] == true {
                            n += 1; // increment live count
                        }
                    }
                }
                j += 1;
            }
            i += 1;
            j = -1;
        }
        // return live count
        n
    }
fn count_live_neighbors ( & mut self , row : usize , col : usize ) -> usize { // live nieghbor count let mut n : usize = 0 ; // negatives are not allowed in ranges in rust :/ // so i have to shift things and make i32 copies of the usizes let mut i : i32 = - 1 ; let mut j : i32 = - 1 ; let r : i32 = row . try_into ( ) . unwrap ( ) ; let c : i32 = col . try_into ( ) . unwrap ( ) ; let height : i32 = self . height . try_into ( ) . unwrap ( ) ; let width : i32 = self . width . try_into ( ) . unwrap ( ) ; // iterate through neighbors while i < 2 { while j < 2 { if i == 0 && j == 0 { // if at reference element // do nothing (quick but lazy sorry) } else { // if location is in board if r + i >= 0 && r + i < height && c + j >= 0 && c + j < width { // if live // can only index with usize so must typecast if self . board [ ( r + i ) as usize ] [ ( c + j ) as usize ] == true { n += 1 ; // increment live count } } } j += 1 ; } i += 1 ; j = - 1 ; } // return live count n }
counts the number of neighbors around board element at (row,col) that are alive
counts the number of neighbors around board element at ( row col ) that are alive
&mut self
row
usize
col
usize