Conway's Game of Life is a simple algorithm that produces complex and often beautiful results. It is played on a grid and follows the rules below.
If the grid above is generation 1, what is the number of the last generation with living cells?
Details and assumptions
Every cell not on the edges of the grid has neighbors: namely, any cell that is horizontally, vertically, or diagonally adjacent.
A generation constitutes one simultaneous application of the rules to every cell in the grid.
If you are interested in the idea of self-organization, you might also like this problem .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Perhaps not the most elegant way to solve it, but I think it is quite straightforward, in C/C++. #include <stdio.h>