Play the Simulation Game Life
This program calculates one generation in the game Life.
Life was invented by the mathematician John Conway. The game board is a two-dimensional grid, on which each cell is either occupied or not. The next generation is calculated according to the following rules:
For each cell, calculate the number of occupied neighbors from the eight possible neighbors (including diagonal neighbors).
If a cell is occupied and has two or three neighbors, it is occupied in the next generation; otherwise, it dies and is unoccupied in the next generation.
If a cell is empty and has exactly three neighbors, a new occupant is born and the ...
Get Find the Bug A Book of Incorrect Programs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.