Created
April 1, 2017 14:27
-
-
Save conradoqg/ecbe847b683c224418769be17d3243eb to your computer and use it in GitHub Desktop.
Selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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