fn reset_cells(&mut self, cells: &[LifeSender]) {
        log::info!("regenerating");
        // give things a chance to quiet down
        thread::sleep(Duration::from_millis(50));
        let mut cell_states: Vec<CellState> = Vec::with_capacity(cells.len());
        for _ in 0 .. cells.len() {
            cell_states.push(CellState::Dead)
        }
        for _ in 0 .. self.limit {
            cell_states[self.range.sample(&mut self.rng)] = CellState::Alive;
        }
        cells
            .iter()
            .zip(cell_states.iter())
            .for_each(|(sender, state)| sender.send(LifeCmd::SetState(*state)).unwrap());
        // calling set_cells with no changes ensures we're synchronized
        set_cells(cells, Vec::<(usize, usize)>::new().as_slice());
        // give things a chance to quiet down
        thread::sleep(Duration::from_millis(50));
    }
// generate cells that are either alive or dead
generate cells that are either alive or dead
generate cells that are either alive or dead
fn reset_cells(&mut self, cells: &[LifeSender]) {
        log::info!("regenerating");
        // give things a chance to quiet down
        thread::sleep(Duration::from_millis(50));
        let mut cell_states: Vec<CellState> = Vec::with_capacity(cells.len());
        for _ in 0 .. cells.len() {
            cell_states.push(CellState::Dead)
        }
        for _ in 0 .. self.limit {
            cell_states[self.range.sample(&mut self.rng)] = CellState::Alive;
        }
        cells
            .iter()
            .zip(cell_states.iter())
            .for_each(|(sender, state)| sender.send(LifeCmd::SetState(*state)).unwrap());
        // calling set_cells with no changes ensures we're synchronized
        set_cells(cells, Vec::<(usize, usize)>::new().as_slice());
        // give things a chance to quiet down
        thread::sleep(Duration::from_millis(50));
    }
fn reset_cells ( & mut self , cells : & [ LifeSender ] ) { log :: info ! ( " " ) ; // give things a chance to quiet down thread :: sleep ( Duration :: from_millis ( 50 ) ) ; let mut cell_states : Vec < CellState > = Vec :: with_capacity ( cells . len ( ) ) ; for _ in 0 .. cells . len ( ) { cell_states . push ( CellState :: Dead ) } for _ in 0 .. self . limit { cell_states [ self . range . sample ( & mut self . rng ) ] = CellState :: Alive ; } cells . iter ( ) . zip ( cell_states . iter ( ) ) . for_each ( | ( sender , state ) | sender . send ( LifeCmd :: SetState ( * state ) ) . unwrap ( ) ) ; // calling set_cells with no changes ensures we're synchronized set_cells ( cells , Vec :: < ( usize , usize ) > :: new ( ) . as_slice ( ) ) ; // give things a chance to quiet down thread :: sleep ( Duration :: from_millis ( 50 ) ) ; }
generate cells that are either alive or dead
generate cells that are either alive or dead
&mut self
cells
&[LifeSender]