Requires that the grid, signals, and peeps containers have been allocated. This will erase the grid and signal layers, then create a new population in the peeps container at random locations with random genomes.
| 16 | // This will erase the grid and signal layers, then create a new population in |
| 17 | // the peeps container at random locations with random genomes. |
| 18 | void initializeGeneration0() |
| 19 | { |
| 20 | // The grid has already been allocated, just clear and reuse it |
| 21 | grid.zeroFill(); |
| 22 | grid.createBarrier(p.barrierType); |
| 23 | |
| 24 | // The signal layers have already been allocated, so just reuse them |
| 25 | signals.zeroFill(); |
| 26 | |
| 27 | // Spawn the population. The peeps container has already been allocated, |
| 28 | // just clear and reuse it |
| 29 | for (uint16_t index = 1; index <= p.population; ++index) { |
| 30 | peeps[index].initialize(index, grid.findEmptyLocation(), makeRandomGenome()); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | |
| 35 | // Requires a container with one or more parent genomes to choose from. |
no test coverage detected