After each generation, the cells interact with their eight neighbors, which are cells adjacent horizontally, vertically, or diagonally.
The following rules are applied to each cell:
Given a matrix of 1s and 0s (corresponding to live and dead cells), apply the rules to each cell, and return the next generation.
After each generation, the cells interact with their eight neighbors, which are cells adjacent horizontally, vertically, or diagonally.
The following rules are applied to each cell:
Given a matrix of 1s and 0s (corresponding to live and dead cells), apply the rules to each cell, and return the next generation.