Skip to content

Instantly share code, notes, and snippets.

@conradoqg
Created April 1, 2017 14:27
Show Gist options
  • Select an option

  • Save conradoqg/ecbe847b683c224418769be17d3243eb to your computer and use it in GitHub Desktop.

Select an option

Save conradoqg/ecbe847b683c224418769be17d3243eb to your computer and use it in GitHub Desktop.
Selection
// Randomly choose two partners from mating pool and mate them
let newOrganisms = [];
for (let i = 0; i < this.organisms.length; i++) {
const parentA = p5i.random(this.matingPool);
const parentB = p5i.random(this.matingPool);
const child = parentA.mate(parentB);
newOrganisms[i] = child;
}
this.organisms = newOrganisms;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment