fn advance( &mut self, xr: i64, yr: i64, zr: i64, wr: i64 ) {
        let mut count = HashMap::new();

        // Count cubes in the neighbouring region of each cube, including self.
        for &(x, y, z, w) in self.0.iter() {
            for dw in -wr..=wr {
                for dz in -zr..=zr {
                    for dy in -yr..=yr {
                        for dx in -xr..=xr {
                            *count.entry((x+dx, y+dy, z+dz, w+dw)).or_insert(0) += 1;
                        }
                    }
                }
            }
        }

        // Update active cubes.
        for (cube, n) in count.into_iter() {
            if self.0.contains(&cube) {
                match n-1 {
                    2 | 3 => {},
                    _ => { self.0.remove(&cube); }
                }
            } else {
                match n {
                    3 => { self.0.insert(cube); },
                    _ => {}
                }
            }
        }
    }
// apply the the rules using a neighborhood radius of (xr, yr, zr, wr)
apply the the rules using a neighborhood radius of (xr, yr, zr, wr)
apply the the rules using a neighborhood radius of ( xr yr zr wr )
fn advance( &mut self, xr: i64, yr: i64, zr: i64, wr: i64 ) {
        let mut count = HashMap::new();
        // Count cubes in the neighbouring region of each cube, including self.
        for &(x, y, z, w) in self.0.iter() {
            for dw in -wr..=wr {
                for dz in -zr..=zr {
                    for dy in -yr..=yr {
                        for dx in -xr..=xr {
                            *count.entry((x+dx, y+dy, z+dz, w+dw)).or_insert(0) += 1;
                        }
                    }
                }
            }
        }
        // Update active cubes.
        for (cube, n) in count.into_iter() {
            if self.0.contains(&cube) {
                match n-1 {
                    2 | 3 => {},
                    _ => { self.0.remove(&cube); }
                }
            } else {
                match n {
                    3 => { self.0.insert(cube); },
                    _ => {}
                }
            }
        }
    }
fn advance ( & mut self , xr : i64 , yr : i64 , zr : i64 , wr : i64 ) { let mut count = HashMap :: new ( ) ; // Count cubes in the neighbouring region of each cube, including self. for & ( x , y , z , w ) in self . 0 . iter ( ) { for dw in - wr ..= wr { for dz in - zr ..= zr { for dy in - yr ..= yr { for dx in - xr ..= xr { * count . entry ( ( x + dx , y + dy , z + dz , w + dw ) ) . or_insert ( 0 ) += 1 ; } } } } } // Update active cubes. for ( cube , n ) in count . into_iter ( ) { if self . 0 . contains ( & cube ) { match n - 1 { 2 | 3 => { } , _ => { self . 0 . remove ( & cube ) ; } } } else { match n { 3 => { self . 0 . insert ( cube ) ; } , _ => { } } } } }
apply the the rules using a neighborhood radius of (xr, yr, zr, wr)
apply the the rules using a neighborhood radius of ( xr yr zr wr )
&mut self
xr
i64
yr
i64
zr
i64
wr
i64