Workshop › Conway's Game of Life › Step 12 of 32
How old is the world? A counter generation starts at 0 with every new soup and grows by 1 with every step.
```js
let generation
function randomize() {
grid = grid.map((row) => row.map(() => (Math.random() < 0.25 ? 1 : 0)))
generation = 0
}
grid = next
generation += 1
}
```let generation declares the counter.randomize sets it to 0: a new world starts at generation 0.generation += 1 at the end of step adds one for each new generation.let grid ... write let generation.randomize, write generation = 0.step, under grid = next, write generation += 1.Skills: Game states
← Next generation with N Show the generation →