fn update(_app: &App, model: &mut Model, _update: Update) {
  let now = SystemTime::now();

  // accelerator
  for _ in 0..20 {
    // draw all travelers
    for traveller in &mut model.travellers {
      traveller.update(model.phase);
    }
  }

  // random mutations
  for _ in 0..2 {
    let idx = random_range(0, model.n_travellers);
    // model.travellers[idx] = model.travellers[idx].rebirth();
    model.travellers[idx].rebirth();
  }

  // swap next and grid
  match now.elapsed() {
    Ok(elapsed) => model.update_times.push(elapsed.as_millis()),
    Err(e) => println!("Update Error: {:?}", e),
  }
}
// all calculations and grid updates and next/grid swaps should happen here
all calculations and grid updates and next/grid swaps should happen here
all calculations and grid updates and next / grid swaps should happen here
fn update(_app: &App, model: &mut Model, _update: Update) {
  let now = SystemTime::now();
  // accelerator
  for _ in 0..20 {
    // draw all travelers
    for traveller in &mut model.travellers {
      traveller.update(model.phase);
    }
  }
  // random mutations
  for _ in 0..2 {
    let idx = random_range(0, model.n_travellers);
    // model.travellers[idx] = model.travellers[idx].rebirth();
    model.travellers[idx].rebirth();
  }
  // swap next and grid
  match now.elapsed() {
    Ok(elapsed) => model.update_times.push(elapsed.as_millis()),
    Err(e) => println!("Update Error: {:?}", e),
  }
}
fn update ( _app : & App , model : & mut Model , _update : Update ) { let now = SystemTime :: now ( ) ; // accelerator for _ in 0 .. 20 { // draw all travelers for traveller in & mut model . travellers { traveller . update ( model . phase ) ; } } // random mutations for _ in 0 .. 2 { let idx = random_range ( 0 , model . n_travellers ) ; // model.travellers[idx] = model.travellers[idx].rebirth(); model . travellers [ idx ] . rebirth ( ) ; } // swap next and grid match now . elapsed ( ) { Ok ( elapsed ) => model . update_times . push ( elapsed . as_millis ( ) ) , Err ( e ) => println ! ( " " e ) , } }
all calculations and grid updates and next/grid swaps should happen here
all calculations and grid updates and next / grid swaps should happen here
_app
&App
model
&mut Model
_update
Update