fn consider_inactive(&mut self) {
        // Consider a cube that wraps our max active cube, and check all points
        // within that.
        let (min, max) = self.bounds();
        let min = min - 1;
        let max = max + 1;
        // TODO: make recursive by dim, fewer loops
        for x in min..=max {
            for y in min..=max {
                for z in min..=max {
                    if self.dim == 3 {
                        // part 1
                        if self.active.contains(&[x, y, z, 0]) {
                            continue;
                        }
                        let num_n = self.count_neighbors(x, y, z, 0);
                        if num_n == 3 {
                            self.next.insert([x, y, z, 0]);
                        }
                    } else {
                        // part 2
                        for w in min..=max {
                            if self.active.contains(&[x, y, z, w]) {
                                continue;
                            }
                            let num_n = self.count_neighbors(x, y, z, w);
                            if num_n == 3 {
                                self.next.insert([x, y, z, w]);
                            }
                        } // for w
                    }
                } // for z
            } // for y
        } // for x
    }
// If a cube is inactive but exactly 3 of its neighbors are
// active, the cube becomes active. Otherwise, the cube remains inactive.
If a cube is inactive but exactly 3 of its neighbors are
active, the cube becomes active. Otherwise, the cube remains inactive.
If a cube is inactive but exactly 3 of its neighbors are active the cube becomes active . Otherwise the cube remains inactive .
fn consider_inactive(&mut self) {
        // Consider a cube that wraps our max active cube, and check all points
        // within that.
        let (min, max) = self.bounds();
        let min = min - 1;
        let max = max + 1;
        // TODO: make recursive by dim, fewer loops
        for x in min..=max {
            for y in min..=max {
                for z in min..=max {
                    if self.dim == 3 {
                        // part 1
                        if self.active.contains(&[x, y, z, 0]) {
                            continue;
                        }
                        let num_n = self.count_neighbors(x, y, z, 0);
                        if num_n == 3 {
                            self.next.insert([x, y, z, 0]);
                        }
                    } else {
                        // part 2
                        for w in min..=max {
                            if self.active.contains(&[x, y, z, w]) {
                                continue;
                            }
                            let num_n = self.count_neighbors(x, y, z, w);
                            if num_n == 3 {
                                self.next.insert([x, y, z, w]);
                            }
                        } // for w
                    }
                } // for z
            } // for y
        } // for x
    }
fn consider_inactive ( & mut self ) { // Consider a cube that wraps our max active cube, and check all points // within that. let ( min , max ) = self . bounds ( ) ; let min = min - 1 ; let max = max + 1 ; // TODO: make recursive by dim, fewer loops for x in min ..= max { for y in min ..= max { for z in min ..= max { if self . dim == 3 { // part 1 if self . active . contains ( & [ x , y , z , 0 ] ) { continue ; } let num_n = self . count_neighbors ( x , y , z , 0 ) ; if num_n == 3 { self . next . insert ( [ x , y , z , 0 ] ) ; } } else { // part 2 for w in min ..= max { if self . active . contains ( & [ x , y , z , w ] ) { continue ; } let num_n = self . count_neighbors ( x , y , z , w ) ; if num_n == 3 { self . next . insert ( [ x , y , z , w ] ) ; } } // for w } } // for z } // for y } // for x }
If a cube is inactive but exactly 3 of its neighbors are
active, the cube becomes active.
If a cube is inactive but exactly 3 of its neighbors are active the cube becomes active .
&mut self